allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [4/5] git commit: [#6487] handle more complex content-types, e.g. from http://code.google.com/p/msysgit/logo?cct=1342277278
Date Tue, 23 Jul 2013 20:16:30 GMT
[#6487] handle more complex content-types, e.g. from http://code.google.com/p/msysgit/logo?cct=1342277278


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

Branch: refs/heads/db/6487
Commit: 9fab0e662a86b56f9cdd00b471079e8ad083d437
Parents: 1ac73de
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Tue Jul 23 20:15:30 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Jul 23 20:15:30 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/filesystem.py                | 1 +
 ForgeImporters/forgeimporters/google/__init__.py | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9fab0e66/Allura/allura/model/filesystem.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/filesystem.py b/Allura/allura/model/filesystem.py
index 1bb0087..dbe1aa7 100644
--- a/Allura/allura/model/filesystem.py
+++ b/Allura/allura/model/filesystem.py
@@ -162,6 +162,7 @@ class File(MappedClass):
         if content_type is None:
             content_type = utils.guess_mime_type(filename)
         if not content_type.lower() in SUPPORTED_BY_PIL:
+            log.debug('Content type %s from file %s not supported', content_type, filename)
             return None, None
 
         try:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9fab0e66/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 332d075..f4a7b7a 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -69,8 +69,9 @@ class GoogleCodeProjectExtractor(object):
         fp_ish = urllib2.urlopen(icon_url)
         fp = StringIO(fp_ish.read())
         M.ProjectFile.save_image(
-            icon_name, fp, fp_ish.info()['content-type'], square=True,
-            thumbnail_size=(48,48),
+            icon_name, fp,
+            fp_ish.info()['content-type'].split(';')[0],  # strip off charset=x extra param,
+            square=True, thumbnail_size=(48,48),
             thumbnail_meta={'project_id': self.project._id, 'category': 'icon'})
 
     def get_license(self):


Mime
View raw message