Commits

Stephen McDonald committed 4921f86

Strip querystrings from extension validation.

Comments (0)

Files changed (1)

filebrowser_safe/fields.py

         value = super(FileBrowseFormField, self).clean(value)
         if value == '':
             return value
-        file_extension = os.path.splitext(value)[1].lower()
+        file_extension = os.path.splitext(value)[1].lower().split("?")[0]
         if self.extensions and not file_extension in self.extensions:
             raise forms.ValidationError(self.error_messages['extension'] % {'ext': file_extension, 'allowed': ", ".join(self.extensions)})
         return value