Patch from breton: fix #5053 (gmg addmedia broken in 0.8.0)
authorChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 5 Mar 2015 23:45:54 +0000 (17:45 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 5 Mar 2015 23:45:54 +0000 (17:45 -0600)
mediagoblin/media_types/__init__.py

index ab39fa3699a3f4182185522c19b074032725e7dd..3eeead863e529b7a4633b6df3f2fd5eefc1c10d6 100644 (file)
@@ -16,6 +16,7 @@
 
 import os
 import logging
+import shutil
 import tempfile
 
 from mediagoblin.tools.pluginapi import hook_handle
@@ -143,7 +144,7 @@ def sniff_media(media_file, filename):
     # copy the contents to a .name-enabled temporary file for further checks
     # TODO: there are cases when copying is not required
     tmp_media_file = tempfile.NamedTemporaryFile()
-    media_file.save(tmp_media_file.name)
+    shutil.copyfileobj(media_file, tmp_media_file)
     media_file.seek(0)
     try:
         return type_match_handler(tmp_media_file, filename)