You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/12/13 06:07:55 UTC

[09/45] git commit: [#6960] deal with google code bogus Content-Type header

[#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/tv/6942
Commit: 2374176399a84cdd2d70ca8d42cec5308aa23edc
Parents: 4062227
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 6 17:41:54 2013 +0000
Committer: Dave Brondsema <db...@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'})