From e295bd95d80632311645a4450241b27ef63e7b3c Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 24 May 2016 14:56:50 +0200 Subject: [PATCH] Ugly hack to temporary disable thumbnail generation for tiff files --- taiga/base/utils/thumbnails.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/taiga/base/utils/thumbnails.py b/taiga/base/utils/thumbnails.py index 2c2ffca0..1337ad84 100644 --- a/taiga/base/utils/thumbnails.py +++ b/taiga/base/utils/thumbnails.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +import os + +from django.db.models.fields.files import FieldFile + from taiga.base.utils.urls import get_absolute_url from easy_thumbnails.files import get_thumbnailer @@ -22,6 +26,15 @@ from easy_thumbnails.exceptions import InvalidImageFormatError def get_thumbnail_url(file_obj, thumbnailer_size): + # Ugly hack to temporary ignore tiff files + relative_name = file_obj + if isinstance(file_obj, FieldFile): + relative_name = file_obj.name + + source_extension = os.path.splitext(relative_name)[1][1:] + if source_extension == "tiff": + return None + try: path_url = get_thumbnailer(file_obj)[thumbnailer_size].url thumb_url = get_absolute_url(path_url)