mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-05 05:28:43 +08:00
修复文件名末为空格时get_available_file_name()出错的bug
This commit is contained in:
parent
a91b22df49
commit
8fd13a70c0
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user