fixed predavanja bug

This commit is contained in:
msinkec 2021-05-25 15:13:25 +02:00
parent 621d411e30
commit 74c085b0a7

View File

@ -194,13 +194,11 @@ class UploadHandler:
except Exception:
traceback.print_exc()
@staticmethod
def check_suffixes(files):
def check_suffixes(self, files):
for key, f in files.items():
if key.startswith('file'):
suffix = f.filename.split('.')[-1]
if ENABLED_FILETYPES and suffix not in ENABLED_FILETYPES:
if self.ENABLED_FILETYPES and suffix not in self.ENABLED_FILETYPES:
return 'Datoteka "{}" ni pravilnega formata.'.format(f.filename)
return None
@ -220,7 +218,7 @@ class UploadHandler:
elif len(files) < 1:
return 'Priložena ni bila nobena datoteka.', 400
err = UploadHandler.check_suffixes(files)
err = self.check_suffixes(files)
if err:
return err, 400