fix: preserve nested playlist paths when formatting

This commit is contained in:
chen zhihao
2026-08-31 20:52:37 +08:00
parent 8b84d0585d
commit 1b6b7db25a
4 changed files with 29 additions and 4 deletions
+10
View File
@@ -44,6 +44,16 @@ export function normalizeURL(url: string): string {
return decodeURIComponent(normalized).replace(/\s/g, '+').toString()
}
export function getStoragePath(filepath: string, rootDir: string): string {
const relative = path.relative(path.resolve(rootDir), path.resolve(filepath))
if (relative && relative !== '..' && !relative.startsWith(`..${path.sep}`)) {
return relative
}
return filepath
}
export function truncate(string: string, limit: number = 100) {
if (!string) return string
if (string.length < limit) return string