diff --git a/boards/models/attachment/__init__.py b/boards/models/attachment/__init__.py --- a/boards/models/attachment/__init__.py +++ b/boards/models/attachment/__init__.py @@ -48,7 +48,7 @@ class Attachment(models.Model): if file_viewer is None: file_viewer = AbstractViewer - return file_viewer(self.file, self.mimetype).get_view() + return file_viewer(self.file, self.mimetype, self.hash).get_view() def __str__(self): return self.file.url diff --git a/boards/models/attachment/viewers.py b/boards/models/attachment/viewers.py --- a/boards/models/attachment/viewers.py +++ b/boards/models/attachment/viewers.py @@ -39,9 +39,10 @@ def get_viewers(): class AbstractViewer: - def __init__(self, file, file_type): + def __init__(self, file, file_type, hash): self.file = file self.file_type = file_type + self.hash = hash @staticmethod def supports(file_type): @@ -115,6 +116,7 @@ class ImageViewer(AbstractViewer): return '' \ '{}' \ .format(CSS_CLASS_THUMB, thumb_url, + self.hash, str(pre_width), str(pre_height), str(width), str(height), full=self.file.url, image_meta=metadata)