Check tags for existence before using them
authorBoris Bobrov <breton@cynicmansion.ru>
Tue, 8 Mar 2016 14:23:15 +0000 (17:23 +0300)
committerBoris Bobrov <breton@cynicmansion.ru>
Tue, 8 Mar 2016 14:37:04 +0000 (17:37 +0300)
Closes bug 5401

mediagoblin/media_types/video/util.py

index d3d292794369be9c8ba3d0b8fe02b61069f9eee3..10705eab715bd1f435bf16dd42557739a6b351c4 100644 (file)
@@ -30,10 +30,15 @@ def skip_transcode(metadata, size):
     config = mgg.global_config['plugins']['mediagoblin.media_types.video']\
             ['skip_transcode']
 
+    # XXX: how were we supposed to use it?
     medium_config = mgg.global_config['media:medium']
 
     _log.debug('skip_transcode config: {0}'.format(config))
+
     tags = metadata.get_tags()
+    if not tags:
+        return False
+
     if config['mime_types'] and tags.get_string('mimetype')[0]:
         if not tags.get_string('mimetype')[1] in config['mime_types']:
             return False