# 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
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