incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject git commit: [#6960] deal with google code bogus Content-Type header
Date Fri, 06 Dec 2013 17:42:05 GMT
Updated Branches:
  refs/heads/db/6960 [created] 237417639


[#6960] deal with google code bogus Content-Type header


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

Branch: refs/heads/db/6960
Commit: 2374176399a84cdd2d70ca8d42cec5308aa23edc
Parents: 4062227
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Fri Dec 6 17:41:54 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Dec 6 17:41:54 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/23741763/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index c4b9a99..87990d0 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -159,8 +159,12 @@ class GoogleCodeProjectExtractor(ProjectExtractor):
             return
         icon_name = urllib.unquote(urlparse(icon_url).path).split('/')[-1]
         icon = File(icon_url, icon_name)
+        filetype = icon.type
+        # work around Google Code giving us bogus file type
+        if filetype.startswith('text/html'):
+            filetype = 'image/png'
         M.ProjectFile.save_image(
-            icon_name, icon.file, icon.type,
+            icon_name, icon.file, filetype,
             square=True, thumbnail_size=(48,48),
             thumbnail_meta={'project_id': project._id, 'category': 'icon'})
 


Mime
View raw message