From 841e3d1e639461bc5444061d5da13eecd50bb70f Mon Sep 17 00:00:00 2001 From: helmutm Date: Wed, 21 Jan 2009 06:52:24 +0000 Subject: [PATCH] keep extension for application/octet-stream git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3168 fd906abe-77d9-0310-91a1-e0d9ade77398 --- integrator/browser/bscw.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/integrator/browser/bscw.py b/integrator/browser/bscw.py index ab83d14..c01f840 100644 --- a/integrator/browser/bscw.py +++ b/integrator/browser/bscw.py @@ -88,11 +88,17 @@ class ItemView(BaseView): baseUrl = urlInfo.baseUrl while 'bscw.cgi' in baseUrl and not baseUrl.endswith('bscw.cgi'): baseUrl, ignore = baseUrl.rsplit('/', 1) - extensions = '.' + (mimeTypes.get(self.context.contentType) or ['bin']) - extension = extensions[0] - for ext in extensions: - if self.title.endswith('.' + ext): - extension = '' + if (self.context.contentType == 'application/octet-stream' and + len(self.title) > 3 and self.title[-4] == '.'): + extension = '' + else: + extensions = mimeTypes.get(self.context.contentType) or ['bin'] + for ext in extensions: + if self.title.endswith('.' + ext): + extension = '' + break + else: + extension = '.' + extensions[0] return '%s/d%s/%s%s' % (baseUrl, urlInfo.path, self.title, extension) @property