diff --git a/browser/resource.py b/browser/resource.py index d3c29ed..ed0acd7 100644 --- a/browser/resource.py +++ b/browser/resource.py @@ -157,7 +157,8 @@ class ResourceView(BaseView): response.setHeader('Content-Type', context.contentType) response.setHeader('Content-Length', len(data)) ct = context.contentType - if useAttachment or (not ct.startswith('image/') and ct != 'application/pdf'): + #if useAttachment or (not ct.startswith('image/') and ct != 'application/pdf'): + if useAttachment: response.setHeader('Content-Disposition', 'attachment; filename=%s' % zapi.getName(self.context)) return data @@ -166,6 +167,12 @@ class ResourceView(BaseView): """ Force download, e.g. of a PDF file """ return self.show(True) + @property + def viewable(self): + return True + ct = self.context.contentType + return ct.startswith('image/') or ct == 'application/pdf' + def getActions(self, category='object'): renderer = node_macros.macros['external_edit'] node = self.request.annotations.get('loops.view', {}).get('node') diff --git a/browser/resource_macros.pt b/browser/resource_macros.pt index 25a6d4c..62e19cd 100644 --- a/browser/resource_macros.pt +++ b/browser/resource_macros.pt @@ -49,16 +49,20 @@
Description
Download
-
- Download
-
+