mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
icon fix
This commit is contained in:
parent
0fcb015f9a
commit
7b54a63396
|
@ -1208,18 +1208,21 @@ class HttpCli(object):
|
|||
return True
|
||||
|
||||
def tx_ico(self, ext, exact=False):
|
||||
if ext.endswith("/"):
|
||||
ext = "folder"
|
||||
exact = True
|
||||
|
||||
bad = re.compile(r"[](){}/[]|^[0-9_-]*$")
|
||||
n = ext.split(".")[::-1]
|
||||
if not exact:
|
||||
if ext.endswith("/"):
|
||||
ext = "a.folder"
|
||||
n = n[:-1]
|
||||
|
||||
bad = re.compile(r"[](){}[]|^[0-9_-]*$")
|
||||
n = ext.split(".")[1:][::-1]
|
||||
ext = ""
|
||||
for v in n:
|
||||
if len(v) > 7 or bad.search(v):
|
||||
break
|
||||
ext = ""
|
||||
for v in n:
|
||||
if len(v) > 7 or bad.search(v):
|
||||
break
|
||||
|
||||
ext = "{}.{}".format(v, ext)
|
||||
ext = "{}.{}".format(v, ext)
|
||||
|
||||
ext = ext.rstrip(".") or "unk"
|
||||
if len(ext) > 11:
|
||||
|
|
Loading…
Reference in a new issue