newamericafoundation / newamerica-cms

CMS for New America
https://www.newamerica.org/
5 stars 5 forks source link

IOError for Truncated Image Files #1247

Closed lomaxap closed 7 years ago

lomaxap commented 7 years ago
Template error:
In template /app/blog/templates/blog/blog_post.html, error at line 0
   image file is truncated (62 bytes not processed)
   1 : {% extends "post_page.html" %}
   2 :
   3 : {% load wagtailcore_tags %}
   4 : {% load wagtailcore_tags wagtailimages_tags %}
   5 : {% load utilities %}
   6 :
   7 : {% block body_class %}template-blogpost{% endblock %}
   8 :
   9 : {% block post-header %}
   10 :         {% image page.story_image min-1100x650 as story_image %}

Traceback:

File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
  39.             response = get_response(request)

File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  217.                 response = self.process_exception_by_middleware(e, request)

File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  215.                 response = response.render()

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/response.py" in render
  109.             self.content = self.rendered_content

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  86.         content = template.render(context, self._request)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/backends/django.py" in render
  66.             return self.template.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render
  208.                     return self._render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render
  994.                 bit = node.render_annotated(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  961.             return self.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  174.         return compiled_parent._render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render
  994.                 bit = node.render_annotated(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  961.             return self.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  174.         return compiled_parent._render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render
  994.                 bit = node.render_annotated(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  961.             return self.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  174.         return compiled_parent._render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in _render
  199.         return self.nodelist.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render
  994.                 bit = node.render_annotated(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  961.             return self.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  315.                 return nodelist.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render
  994.                 bit = node.render_annotated(context)

File "/app/.heroku/python/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  961.             return self.render(context)

File "/app/.heroku/python/lib/python2.7/site-packages/wagtail/wagtailimages/templatetags/wagtailimages_tags.py" in render
  88.         rendition = get_rendition_or_not_found(image, self.filter)

File "/app/.heroku/python/lib/python2.7/site-packages/wagtail/wagtailimages/shortcuts.py" in get_rendition_or_not_found
  16.         return image.get_rendition(specs)

File "/app/.heroku/python/lib/python2.7/site-packages/wagtail/wagtailimages/models.py" in get_rendition
  284.             generated_image = filter.run(self, BytesIO())

File "/app/.heroku/python/lib/python2.7/site-packages/wagtail/wagtailimages/models.py" in run
  401.             willow = willow.auto_orient()

File "/app/.heroku/python/lib/python2.7/site-packages/willow/image.py" in wrapper
  60.                 image = converter(image)

File "/app/.heroku/python/lib/python2.7/site-packages/willow/plugins/pillow.py" in open
  149.         image.load()

File "/app/.heroku/python/lib/python2.7/site-packages/PIL/ImageFile.py" in load
  225.                                               "(%d bytes not processed)" % len(b))

Exception Type: IOError at /education-policy/edcentral/heritageaction/
Exception Value: image file is truncated (62 bytes not processed)
Request information:
USER: AnonymousUser
lomaxap commented 7 years ago

this is an unresolved wagtail bug. There are probably a dozen or more images that have been truncated or are corrupt. It will throw this error on any template that tries to create a new rendition from the corrupt file in our S3 buckets.