mirror of
https://github.com/iptv-org/iptv
synced 2026-09-06 03:50:47 -04:00
fix: preserve nested playlist paths when formatting
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user