移除音频文件路径 Unicode 控制字符 (#2334)

This commit is contained in:
纸巾 2024-11-23 20:46:42 +08:00 committed by GitHub
parent 3548b4f1a5
commit 9ae3af4a7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@ import numpy as np
import av
from io import BytesIO
import traceback
import re
def wav2(i, o, format):
@ -55,4 +56,5 @@ def load_audio(file, sr):
def clean_path(path_str):
if platform.system() == "Windows":
path_str = path_str.replace("/", "\\")
path_str = re.sub(r'[\u202a\u202b\u202c\u202d\u202e]', '', path_str) # 移除 Unicode 控制字符
return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ")