From 445bf601dca079a6ae49cfe74752f8741bf16d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 2 May 2016 17:04:18 +0200 Subject: [PATCH] Don't double-x mime types --- pillar/application/modules/file_storage.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pillar/application/modules/file_storage.py b/pillar/application/modules/file_storage.py index 26f6879f..17c41885 100644 --- a/pillar/application/modules/file_storage.py +++ b/pillar/application/modules/file_storage.py @@ -196,7 +196,12 @@ def process_file(gcs, file_id, local_file): # Prevent video handling for non-admins. if not user_has_role(u'admin') and mime_category == 'video': - src_file['content_type'] = 'application/x-%s' % src_file['format'] + if src_file['format'].startswith('x-'): + xified = src_file['format'] + else: + xified = 'x-' + src_file['format'] + + src_file['content_type'] = 'application/%s' % xified mime_category = 'application' log.info('Not processing video file %s for non-admin user', file_id)