Skip to content

Commit

Permalink
[Fixes #6817] Displaying document 'image/tiff' is broken because brow…
Browse files Browse the repository at this point in the history
…sers do not support 'img' src tag (#6818)
  • Loading branch information
Alessio Fabiani authored Jan 15, 2021
1 parent 18d680a commit 9546af7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
10 changes: 5 additions & 5 deletions geonode/documents/enumerations.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@

'bm': 'image',
'bmp': 'image',
'dwg': 'image',
'dxf': 'image',
'dwg': 'archive',
'dxf': 'archive',
'fif': 'image',
'gif': 'image',
'jpg': 'image',
'jpe': 'image',
'jpeg': 'image',
'png': 'image',
'tif': 'image',
'tiff': 'image',
'pbm': 'image',
'tif': 'archive',
'tiff': 'archive',
'pbm': 'archive',

'odp': 'presentation',
'ppt': 'presentation',
Expand Down
18 changes: 18 additions & 0 deletions geonode/documents/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from geonode.documents.forms import DocumentFormMixin
from geonode.tests.utils import NotificationsTestsHelper
from geonode.base.populate_test_data import create_models
from geonode.documents.enumerations import DOCUMENT_TYPE_MAP
from geonode.documents.models import Document, DocumentResourceLink


Expand All @@ -76,6 +77,23 @@ def setUp(self):
b'\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
self.anonymous_user = get_anonymous_user()

def test_document_mimetypes_rendering(self):
ARCHIVETYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'archive']
AUDIOTYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'audio']
IMGTYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'image']
VIDEOTYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'video']
self.assertIsNotNone(ARCHIVETYPES)
self.assertIsNotNone(AUDIOTYPES)
self.assertIsNotNone(IMGTYPES)
self.assertIsNotNone(VIDEOTYPES)

# Make sure we won't have template rendering issues
self.assertTrue('dwg' in ARCHIVETYPES)
self.assertTrue('dxf' in ARCHIVETYPES)
self.assertTrue('tif' in ARCHIVETYPES)
self.assertTrue('tiff' in ARCHIVETYPES)
self.assertTrue('pbm' in ARCHIVETYPES)

def test_create_document_with_no_rel(self):
"""Tests the creation of a document with no relations"""

Expand Down

0 comments on commit 9546af7

Please sign in to comment.