1
0
Fork 0
forked from mia/0x0

Fix handling double file name extensions

Long names would get truncated at the end, causing problems
including unresolvable file URLs. Example with default settings:
    .package.lst → .package.

Fixes #61
This commit is contained in:
Mia Herkt 2022-12-01 01:19:05 +01:00
parent 9214bb4832
commit 7661216bc0
No known key found for this signature in database
GPG key ID: 72E154B8622EC191

View file

@ -218,6 +218,8 @@ class File(db.Model):
def get_ext(mime): def get_ext(mime):
ext = "".join(Path(file_.filename).suffixes[-2:]) ext = "".join(Path(file_.filename).suffixes[-2:])
if len(ext) > app.config["FHOST_MAX_EXT_LENGTH"]:
ext = Path(file_.filename).suffixes[-1]
gmime = mime.split(";")[0] gmime = mime.split(";")[0]
guess = guess_extension(gmime) guess = guess_extension(gmime)