diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-06-25 10:31:48 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-06-25 10:31:48 +0100 |
commit | a1ebf82ac03b9641e9afef57cfe2d2ce10f6933f (patch) | |
tree | 432f726fd7664ac94e4eb96b06a5040e590a8591 | |
parent | 172bcb270783c0a6765ba4fdb09cfebbb06162bb (diff) | |
parent | c949180284c29ee118778013f5cacb19a0e2575f (diff) | |
download | grit-l-preview.tar.gz |
Merge from Chromium at DEPS revision 278856android-wear-5.0.0_r1android-l-preview_r2android-cts-5.0_r9android-cts-5.0_r8android-cts-5.0_r7android-cts-5.0_r6android-cts-5.0_r5android-cts-5.0_r4android-cts-5.0_r3android-5.0.2_r3android-5.0.2_r1android-5.0.1_r1android-5.0.0_r7android-5.0.0_r6android-5.0.0_r5.1android-5.0.0_r5android-5.0.0_r4android-5.0.0_r3android-5.0.0_r2android-5.0.0_r1lollipop-wear-releaselollipop-releaselollipop-devlollipop-cts-releasel-preview
This commit was generated by merge_to_master.py.
Change-Id: I8956ac2454fa003e127669fed8ac8883bb92cde5
-rwxr-xr-x | grit/format/html_inline.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/grit/format/html_inline.py b/grit/format/html_inline.py index c2b898e..66a957a 100755 --- a/grit/format/html_inline.py +++ b/grit/format/html_inline.py @@ -22,8 +22,10 @@ from grit import util # There is a python bug that makes mimetypes crash if the Windows # registry contains non-Latin keys ( http://bugs.python.org/issue9291 # ). Initing manually and blocking external mime-type databases will -# prevent that bug and still give us the data we need. +# prevent that bug and if we add svg manually, it will still give us +# the data we need. mimetypes.init([]) +mimetypes.add_type('image/svg+xml', '.svg') DIST_DEFAULT = 'chromium' DIST_ENV_VAR = 'CHROMIUM_BUILD' @@ -52,17 +54,6 @@ _ICON_RE = lazy_re.compile( re.MULTILINE) - -def FixupMimeType(mime_type): - """Helper function that normalizes platform differences in the mime type - returned by the Python's mimetypes.guess_type API. - """ - mappings = { - 'image/x-png': 'image/png' - } - return mappings[mime_type] if mime_type in mappings else mime_type - - def GetDistribution(): """Helper function that gets the distribution we are building. @@ -115,7 +106,10 @@ def SrcInlineAsDataURL( if names_only: return "" - mimetype = FixupMimeType(mimetypes.guess_type(filename)[0]) or 'text/plain' + mimetype = mimetypes.guess_type(filename)[0] + if mimetype is None: + raise Exception('%s is of an an unknown type and ' + 'cannot be stored in a data url.' % filename) inline_data = base64.standard_b64encode(util.ReadFile(filepath, util.BINARY)) prefix = src_match.string[src_match.start():src_match.start('filename')] |