incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [30/50] git commit: [#6766] Guess mimetype of imported attachment
Date Tue, 22 Oct 2013 15:00:57 GMT
[#6766] Guess mimetype of imported attachment

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0dbfbf36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0dbfbf36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0dbfbf36

Branch: refs/heads/cj/6692
Commit: 0dbfbf36c96f8d14ef473f03faaa39344288cb12
Parents: 41c3145
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Thu Oct 17 13:28:43 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Thu Oct 17 13:28:43 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/base.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0dbfbf36/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 0a28ea6..db5fb56 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -40,6 +40,7 @@ from allura.lib.decorators import require_post
 from allura.lib.decorators import task
 from allura.lib.security import require_access
 from allura.lib.plugin import ProjectRegistrationProvider, AdminExtension
+from allura.lib.utils import guess_mime_type
 from allura.lib import helpers as h
 from allura.lib import exceptions
 from allura.lib import validators as v
@@ -510,7 +511,6 @@ class ImportAdminExtension(AdminExtension):
 
 def stringio_parser(page):
     return {
-            'content-type': page.info()['content-type'],
             'data': StringIO(page.read()),
         }
 
@@ -519,7 +519,7 @@ class File(object):
         extractor = ProjectExtractor(None, url, parser=stringio_parser)
         self.url = url
         self.filename = filename or os.path.basename(urlparse(url).path)
-        self.type = extractor.page['content-type'].split(';')[0]
+        self.type = guess_mime_type(filename)
         self.file = extractor.page['data']
 
 


Mime
View raw message