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') |