aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-06-07 00:36:24 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-06-07 00:36:24 -0500
commiteb21f9a6cb24adeeea10e26442f92a968a38c53e (patch)
tree0e68fccc768e08e39164b9a5f6e8f5aa0b4575ac
parentfe4ffb860fcf211406861a726c64439435964f4c (diff)
downloadmediagoblin-eb21f9a6cb24adeeea10e26442f92a968a38c53e.tar.lz
mediagoblin-eb21f9a6cb24adeeea10e26442f92a968a38c53e.tar.xz
mediagoblin-eb21f9a6cb24adeeea10e26442f92a968a38c53e.zip
Fixing check_filetype...
We need to check the first part of the guess_type returned tuple, and also this try: except: doesn't belong here, so killing.
-rw-r--r--mediagoblin/submit/security.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/mediagoblin/submit/security.py b/mediagoblin/submit/security.py
index 5a06a499..b2cb6d88 100644
--- a/mediagoblin/submit/security.py
+++ b/mediagoblin/submit/security.py
@@ -16,19 +16,11 @@
from mimetypes import guess_type
-from Image import open as image_open
ALLOWED = ['image/jpeg', 'image/png', 'image/tiff', 'image/gif']
def check_filetype(posted_file):
- if not guess_type(posted_file.filename) in ALLOWED:
- return False
-
- # TODO: This should be handled by the processing stage. We should
- # handle error detection there.
- try:
- image = image_open(posted_file.file)
- except IOError:
+ if not guess_type(posted_file.filename)[0] in ALLOWED:
return False
return True