Closed
Bug 1059826
Opened 10 years ago
Closed 10 years ago
URL field in input API has a max length, but isn't validating it
Categories
(Input Graveyard :: Submission, defect, P1)
Input Graveyard
Submission
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: willkg, Assigned: willkg)
Details
(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/input.allizom.org/input/vendor/src/django/django/core/handlers/base.py", line 113, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib64/python2.6/site-packages/newrelic-2.16.0.12/newrelic/hooks/framework_django.py", line 492, in wrapper
return wrapped(*args, **kwargs)
File "/data/www/input.allizom.org/input/vendor/src/django/django/views/decorators/csrf.py", line 77, in wrapped_view
return view_func(*args, **kwargs)
File "/data/www/input.allizom.org/input/fjord/base/util.py", line 407, in decorated_func
response = f(request, *args, **kwargs)
File "/data/www/input.allizom.org/input/fjord/feedback/api_views.py", line 134, in _feedback_api_router
return post_feedback_api_view(request)
File "/data/www/input.allizom.org/input/vendor/src/django/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/data/www/input.allizom.org/input/vendor/src/django/django/views/decorators/csrf.py", line 77, in wrapped_view
return view_func(*args, **kwargs)
File "/data/www/input.allizom.org/input/vendor/src/django-rest-framework/rest_framework/views.py", line 327, in dispatch
response = self.handle_exception(exc)
File "/data/www/input.allizom.org/input/vendor/src/django-rest-framework/rest_framework/views.py", line 324, in dispatch
response = handler(request, *args, **kwargs)
File "/data/www/input.allizom.org/input/vendor/src/django-rest-framework/rest_framework/generics.py", line 372, in post
return self.create(request, *args, **kwargs)
File "/data/www/input.allizom.org/input/vendor/src/django-rest-framework/rest_framework/mixins.py", line 52, in create
self.object = serializer.save(force_insert=True)
File "/data/www/input.allizom.org/input/vendor/src/django-rest-framework/rest_framework/serializers.py", line 518, in save
self.save_object(self.object, **kwargs)
File "/data/www/input.allizom.org/input/fjord/feedback/models.py", line 661, in save_object
obj.save(**kwargs)
File "/data/www/input.allizom.org/input/fjord/feedback/models.py", line 278, in save
super(Response, self).save(*args, **kwargs)
File "/data/www/input.allizom.org/input/vendor/src/django/django/db/models/base.py", line 546, in save
force_update=force_update, update_fields=update_fields)
File "/data/www/input.allizom.org/input/vendor/src/django/django/db/models/base.py", line 650, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/data/www/input.allizom.org/input/vendor/src/django/django/db/models/manager.py", line 215, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/data/www/input.allizom.org/input/vendor/src/django/django/db/models/query.py", line 1675, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/data/www/input.allizom.org/input/vendor/src/django/django/db/models/sql/compiler.py", line 943, in execute_sql
cursor.execute(sql, params)
File "/data/www/input.allizom.org/input/vendor/src/django/django/db/backends/mysql/base.py", line 130, in execute
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "/data/www/input.allizom.org/input/vendor/src/django/django/db/backends/mysql/base.py", line 120, in execute
return self.cursor.execute(query, args)
File "/usr/lib64/python2.6/site-packages/newrelic-2.16.0.12/newrelic/hooks/database_dbapi2.py", line 21, in execute
return self.__wrapped__.execute(sql, parameters)
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
DatabaseError: (1406, "Data too long for column 'url' at row 1")
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 2•10 years ago
|
||
Pushed this to prod just now.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Updated•8 years ago
|
Product: Input → Input Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•