From 378d43fd166164a9dfa8b8a7e0aa4af20761cc11 Mon Sep 17 00:00:00 2001 From: Yuukiy <76897913+Yuukiy@users.noreply.github.com> Date: Mon, 1 Apr 2024 21:50:55 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20#264:=20=E4=BF=AE=E5=A4=8D=E5=BD=93?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=AD=E5=8C=85=E5=90=AB=E8=BF=9E=E7=BB=AD?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA.=E6=97=B6=E5=88=9B=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E8=B7=AF=E5=BE=84=E4=B8=8D=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E9=A2=84=E6=9C=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/file.py b/core/file.py index 6e1b537cd..6814cc811 100644 --- a/core/file.py +++ b/core/file.py @@ -165,6 +165,7 @@ def get_failed_when_scan(): return failed_items +_PARDIR_REPLACE = re.compile(r'\.{2,}') def replace_illegal_chars(name): """将不能用于文件名的字符替换为形近的字符""" # 非法字符列表 https://stackoverflow.com/a/31976060/6415337 @@ -185,6 +186,9 @@ def replace_illegal_chars(name): name = name.replace(':', ':') else: # 其余都当做Linux处理 name = name.replace('/', '/') + # 处理连续多个英文句点. + if os.pardir in name: + name = _PARDIR_REPLACE.sub('…', name) return name