mirror of
https://git.0x0.st/mia/0x0.git
synced 2024-11-22 16:57:12 +01:00
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
1 changed files with 2 additions and 0 deletions
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 a new issue