X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=mediagoblin%2Fsubmit%2Fsecurity.py;h=6708baf75feadd91e67dff462752959e6183165e;hb=97ec97dbc77373819939557ad20c72a0aced5d61;hp=db4c860de9729e30734c23d21ac0ad7a9e923ee6;hpb=2190ecde8d7ad77daf5e70c165bd36cc4d7e634d;p=mediagoblin.git diff --git a/mediagoblin/submit/security.py b/mediagoblin/submit/security.py index db4c860d..6708baf7 100644 --- a/mediagoblin/submit/security.py +++ b/mediagoblin/submit/security.py @@ -1,5 +1,5 @@ # GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011 Free Software Foundation, Inc +# Copyright (C) 2011 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -16,17 +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 - try: - image = image_open(posted_file.file) - except IOError: +def check_filetype(posted_file): + if not guess_type(posted_file.filename)[0] in ALLOWED: return False return True