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:
parent
9214bb4832
commit
7661216bc0
2
fhost.py
2
fhost.py
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue