fix: sanitize absolute paths

This commit is contained in:
Adam 2025-11-25 16:02:27 -06:00
commit 4477132448
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
18 changed files with 309 additions and 355 deletions

View file

@ -1,3 +1,2 @@
export * from "./path"
export * from "./dom"
export * from "./encode"

View file

@ -1,20 +0,0 @@
import { useSync } from "@/context/sync"
export function getFilename(path: string) {
if (!path) return ""
const trimmed = path.replace(/[\/]+$/, "")
const parts = trimmed.split("/")
return parts[parts.length - 1] ?? ""
}
export function getDirectory(path: string) {
const sync = useSync()
const parts = path.split("/")
const dir = parts.slice(0, parts.length - 1).join("/")
return dir ? sync.sanitize(dir + "/") : ""
}
export function getFileExtension(path: string) {
const parts = path.split(".")
return parts[parts.length - 1]
}