Win文件名中存在#特殊字符时无法正常播放

This commit is contained in:
啊呜
2026-06-13 23:17:45 +08:00
parent 9c364b482e
commit 890b6ea3da

View File

@@ -1,5 +1,6 @@
// 非业务工具方法 // 非业务工具方法
import { pathToFileURL } from 'url'
/** /**
* 获取两个数之间的随机整数大于等于min小于max * 获取两个数之间的随机整数大于等于min小于max
* @param {*} min * @param {*} min
@@ -188,7 +189,7 @@ export const sortInsert = <T>(arr: Array<{ num: number, data: T }>, data: { num:
} }
export const encodePath = (path: string) => { export const encodePath = (path: string) => {
return encodeURI(path.replaceAll('\\', '/')) return pathToFileURL(path).href
} }