From 8fd13a70c052202413926a970c5e68bb166975a5 Mon Sep 17 00:00:00 2001 From: g1879 Date: Fri, 27 Nov 2020 17:25:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E6=9C=AB=E4=B8=BA=E7=A9=BA=E6=A0=BC=E6=97=B6get=5Favailable=5F?= =?UTF-8?q?file=5Fname()=E5=87=BA=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DrissionPage/common.py b/DrissionPage/common.py index 22c9e5d..c062606 100644 --- a/DrissionPage/common.py +++ b/DrissionPage/common.py @@ -256,7 +256,7 @@ def get_available_file_name(folder_path: str, file_name: str) -> str: base_name = file_Path.stem num = base_name.split(' ')[-1] - if num[0] == '(' and num[-1] == ')' and num[1:-1].isdigit(): + if num and num[0] == '(' and num[-1] == ')' and num[1:-1].isdigit(): num = int(num[1:-1]) file_name = f'{base_name.replace(f"({num})", "", -1)}({num + 1}){ext_name}' else: