##// END OF EJS Templates
file-store: handle custom extensions validation better, e.g lower case and both formats .exe / exe
bart -
r3972:c69ff9e6 default
parent child Browse files
Show More
@@ -143,13 +143,18 b' class LocalFileStorage(object):'
143 143 :param ext: extension to check
144 144 :param extensions: iterable of extensions to validate against (or self.extensions)
145 145 """
146 def normalize_ext(_ext):
147 if _ext.startswith('.'):
148 _ext = _ext[1:]
149 return _ext.lower()
146 150
147 151 extensions = extensions or self.extensions
148 152 if not extensions:
149 153 return True
150 if ext.startswith('.'):
151 ext = ext[1:]
152 return ext.lower() in extensions
154
155 ext = normalize_ext(ext)
156
157 return ext in [normalize_ext(x) for x in extensions]
153 158
154 159 def save_file(self, file_obj, filename, directory=None, extensions=None,
155 160 extra_metadata=None, **kwargs):
General Comments 0
You need to be logged in to leave comments. Login now