Closed Bug 919736 Opened 11 years ago Closed 11 years ago

Handling of broken photos could use improvement

Categories

(Participation Infrastructure :: Phonebook, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
2013-10-10

People

(Reporter: cliang, Assigned: giorgos)

References

Details

(Whiteboard: [kb=1125376] )

Attachments

(2 files)

In attempting to edit my own entry (cyliang), I appear to have broken it. Right now, I appear to be able to authenticate via Persona (and show as logged in in the upper right toolbar), but the main text of the page reads "We're Sorry, but Something Went Wrong!". The edit page won't come up but I can sign out.
For the devs; this appears to be the associated traceback. 'HTTP_REFERER': 'https://mozillians.org/en-US/search/?q=cyliang&limit=', Traceback (most recent call last): File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib64/python2.6/site-packages/newrelic-1.10.2.38/newrelic/api/object_wrapper.py", line 220, in __call__ self._nr_instance, args, kwargs) File "/usr/lib64/python2.6/site-packages/newrelic-1.10.2.38/newrelic/hooks/framework_django.py", line 475, in wrapper return wrapped(*args, **kwargs) File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/views/decorators/cache.py", line 89, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/data/www/mozillians.org/mozillians/mozillians/phonebook/views.py", line 40, in home return render(request, 'phonebook/home.html') File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/shortcuts/__init__.py", line 44, in render return HttpResponse(loader.render_to_string(*args, **kwargs), File "/data/www/mozillians.org/mozillians/vendor/lib/python/django/template/loader.py", line 176, in render_to_string return t.render(context_instance) File "/data/www/mozillians.org/mozillians/vendor/src/jingo/jingo/__init__.py", line 189, in render return super(Template, self).render(context_dict) File "/usr/lib64/python2.6/site-packages/newrelic-1.10.2.38/newrelic/api/object_wrapper.py", line 220, in __call__ self._nr_instance, args, kwargs) File "/usr/lib64/python2.6/site-packages/newrelic-1.10.2.38/newrelic/api/function_trace.py", line 82, in dynamic_wrapper return wrapped(*args, **kwargs) File "/usr/lib64/python2.6/site-packages/jinja2/environment.py", line 891, in render return self.environment.handle_exception(exc_info, True) File "/data/www/mozillians.org/mozillians/mozillians/phonebook/templates/phonebook/home.html", line 1, in top-level template code {% extends "base.html" %} File "/data/www/mozillians.org/mozillians/templates/base.html", line 156, in top-level template code {% block content_wrapper %} File "/data/www/mozillians.org/mozillians/templates/base.html", line 159, in block "content_wrapper" {% block content %}{% endblock %} File "/data/www/mozillians.org/mozillians/mozillians/phonebook/templates/phonebook/home.html", line 108, in block "content" <img src="{{ user.userprofile.get_photo_url('150x150') }}" alt="{{ user.username }}"> File "/data/www/mozillians.org/mozillians/mozillians/users/models.py", line 389, in get_photo_url return self.get_photo_thumbnail(geometry, **kwargs).url File "/data/www/mozillians.org/mozillians/mozillians/users/models.py", line 376, in get_photo_thumbnail return get_thumbnail(self.photo, geometry, **kwargs) File "/data/www/mozillians.org/mozillians/vendor-local/lib/python/sorl/thumbnail/shortcuts.py", line 8, in get_thumbnail return default.backend.get_thumbnail(file_, geometry_string, **options) File "/data/www/mozillians.org/mozillians/vendor-local/lib/python/sorl/thumbnail/base.py", line 61, in get_thumbnail thumbnail) File "/data/www/mozillians.org/mozillians/vendor-local/lib/python/sorl/thumbnail/base.py", line 86, in _create_thumbnail image = default.engine.create(source_image, geometry, options) File "/data/www/mozillians.org/mozillians/vendor-local/lib/python/sorl/thumbnail/engines/base.py", line 15, in create image = self.orientation(image, geometry, options) File "/data/www/mozillians.org/mozillians/vendor-local/lib/python/sorl/thumbnail/engines/base.py", line 26, in orientation return self._orientation(image) File "/data/www/mozillians.org/mozillians/vendor-local/lib/python/sorl/thumbnail/engines/pil_engine.py", line 29, in _orientation exif = image._getexif() File "/usr/lib64/python2.6/site-packages/PIL/JpegImagePlugin.py", line 381, in _getexif info.load(file) File "/usr/lib64/python2.6/site-packages/PIL/TiffImagePlugin.py", line 382, in load raise IOError, "not enough data" IOError: not enough data
As requested, I've uploaded a copy of the image which appears to have broken things. It was generated by GraphicConverter, which happily claims that it is a "JPEG/JFIF" file.
I've fixed this for the user by manually clearing the photo in the admin interface. We really shouldn't put photos in the database when resizing throws an exception so I think this bug still wants a better fix.
Summary: Broken personal entry → Handling of broken photos could use improvement
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [kb=1125376]
Assignee: nobody → giorgos
Status: NEW → ASSIGNED
So it seems that PIL (?) freaks out with the EXIF metadata of the image for some reason. I'll work on a patch. Thanks for uploading your avatar :cyliang! :)
Commits pushed to master at https://github.com/mozilla/mozillians https://github.com/mozilla/mozillians/commit/909395e40f58176af5f73ec1f7448ccc15d88c70 [fix bug 919736] Clean broken EXIF data from avatars. https://github.com/mozilla/mozillians/commit/5558b68d8b357bcd30524a2357fc2dabacdd8730 Merge pull request #630 from glogiotatidis/919736 [fix bug 919736] Clean broken EXIF data from avatars.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Can you provide minimal steps to test, I don't quite understand what behavior was changed by pull/630.
Flags: needinfo?(giorgos)
Try to save the image attach in comment 2. It has broken EXIF data. If it saves, then this bug is fixed. Thanks!
Flags: needinfo?(giorgos)
Attached image qa - verified on stage
QA verified on stage - I was able to successfully set my profile photo to attachment 808821 [details]
Status: RESOLVED → VERIFIED
This bug is reopened by https://github.com/mozilla/mozillians/commit/3b04e18fa6abf96a30c5c1b227627852fbfb4b21. The fix was causing a lot of https://bugzilla.mozilla.org/show_bug.cgi?id=922224 Image truncated errors in production.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Depends on: 921243
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2013-10-10
Verified on stage. I updated my profile using the provided photo in comment 2 and it worked as expected. No errors. Happy profiles and photos. Thanks all!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: