From e3aa95e4c0a44d7a03eec76932f2655100c8e748 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 27 2014 17:20:32 +0000 Subject: Fake a StringIO to properly load the image in pillow --- diff --git a/progit/ui/repo.py b/progit/ui/repo.py index e1c55ee..0a8fee0 100644 --- a/progit/ui/repo.py +++ b/progit/ui/repo.py @@ -14,6 +14,7 @@ import os from math import ceil import pygit2 +from cStringIO import StringIO from sqlalchemy.exc import SQLAlchemyError from PIL import Image from pygments import highlight @@ -327,7 +328,7 @@ def view_file(repo, identifier, filename, username=None): if ext in ('.gif', '.png', '.bmp', '.tif', '.tiff', '.jpg', '.jpeg', '.ppm', '.pnm', '.pbm', '.pgm', '.webp', '.ico'): try: - Image.open(filename) + Image.open(StringIO(content.data)) output_type = 'image' except IOError as err: LOG.debug(