Fix mime splitting

mime[:mime.find(";")]   will remove last character if mime does not contain ";".
Use mime.split(";") instead.
This commit is contained in:
Alexey Sakovets 2022-01-01 23:46:41 +03:00
parent 9c4a0fd5a6
commit 0db6e4b895

View File

@ -162,7 +162,7 @@ class File(db.Model):
def get_ext(mime):
ext = "".join(Path(file_.filename).suffixes[-2:])
gmime = mime[:mime.find(";")]
gmime = mime.split(";")[0]
guess = guess_extension(gmime)
app.logger.debug(f"extension - specified: '{ext}' - detected: '{guess}'")