Closed Bug 1059826 Opened 7 years ago Closed 7 years ago

URL field in input API has a max length, but isn't validating it


(Input Graveyard :: Submission, defect, P1)



(Not tracked)



(Reporter: willkg, Assigned: willkg)


(Whiteboard: u=user c=api p=1 s=input.2014q3)

The URL field has a max length (I'm not sure what the exact number is), but it's not validating for the max length when doing an Input API POST. So if you exceed the max length, you get this traceback:

Traceback (most recent call last):

  File "/data/www/", line 113, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib64/python2.6/site-packages/newrelic-", line 492, in wrapper
    return wrapped(*args, **kwargs)

  File "/data/www/", line 77, in wrapped_view
    return view_func(*args, **kwargs)

  File "/data/www/", line 407, in decorated_func
    response = f(request, *args, **kwargs)

  File "/data/www/", line 134, in _feedback_api_router
    return post_feedback_api_view(request)

  File "/data/www/", line 68, in view
    return self.dispatch(request, *args, **kwargs)

  File "/data/www/", line 77, in wrapped_view
    return view_func(*args, **kwargs)

  File "/data/www/", line 327, in dispatch
    response = self.handle_exception(exc)

  File "/data/www/", line 324, in dispatch
    response = handler(request, *args, **kwargs)

  File "/data/www/", line 372, in post
    return self.create(request, *args, **kwargs)

  File "/data/www/", line 52, in create
    self.object =

  File "/data/www/", line 518, in save
    self.save_object(self.object, **kwargs)

  File "/data/www/", line 661, in save_object**kwargs)

  File "/data/www/", line 278, in save
    super(Response, self).save(*args, **kwargs)

  File "/data/www/", line 546, in save
    force_update=force_update, update_fields=update_fields)

  File "/data/www/", line 650, in save_base
    result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)

  File "/data/www/", line 215, in _insert
    return insert_query(self.model, objs, fields, **kwargs)

  File "/data/www/", line 1675, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)

  File "/data/www/", line 943, in execute_sql
    cursor.execute(sql, params)

  File "/data/www/", line 130, in execute
    six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])

  File "/data/www/", line 120, in execute
    return self.cursor.execute(query, args)

  File "/usr/lib64/python2.6/site-packages/newrelic-", line 21, in execute
    return self.__wrapped__.execute(sql, parameters)

  File "/usr/lib64/python2.6/site-packages/MySQLdb/", line 205, in execute
    self.errorhandler(self, exc, value)

  File "/usr/lib64/python2.6/site-packages/MySQLdb/", line 36, in defaulterrorhandler
    raise errorclass, errorvalue

DatabaseError: (1406, "Data too long for column 'url' at row 1")
Pushed this to prod just now.
Closed: 7 years ago
Resolution: --- → FIXED
Product: Input → Input Graveyard
You need to log in before you can comment on or make changes to this bug.