Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: packagerEdge.py

Issue 29360043: Issue 4575 - Fix failing tests in buildtools (Closed)
Patch Set: Created Oct. 28, 2016, 10:37 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | releaseAutomation.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packagerEdge.py
===================================================================
--- a/packagerEdge.py
+++ b/packagerEdge.py
@@ -109,23 +109,26 @@
for filename in names:
files['{}/{}'.format(EXTENSION_DIR, filename)] = files.pop(filename)
def create_content_types_map(filenames):
"""Create [Content_Types].xml -- a mime type map."""
params = {'defaults': {}, 'overrides': {}}
overrides = {
+ '.otf': 'application/octet-stream',
Sebastian Noack 2016/10/28 12:43:51 Why not using 'application/font-sfnt' or 'applicat
Vasily Kuznetsov 2016/11/30 15:11:45 'application/octet-stream' is what Microsoft and F
BLOCKMAP: 'application/vnd.ms-appx.blockmap+xml',
MANIFEST: 'application/vnd.ms-appx.manifest+xml'
}
for filename in filenames:
ext = os.path.splitext(filename)[1]
- if ext:
+ if ext and ext not in params['defaults']:
Sebastian Noack 2016/10/28 12:43:51 Rather than adding a special case here, note that
Vasily Kuznetsov 2016/11/30 15:11:45 You're right, this is better. Done.
content_type = mimetypes.guess_type(filename, strict=False)[0]
+ if ext in overrides:
+ content_type = overrides[ext]
if content_type is not None:
params['defaults'][ext[1:]] = content_type
if filename in overrides:
params['overrides']['/' + filename] = overrides[filename]
content_types_template = _get_template_for(CONTENT_TYPES)
return content_types_template.render(params).encode('utf-8')
« no previous file with comments | « no previous file | releaseAutomation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld