Release 0.0.2

This commit is contained in:
2026-04-20 20:33:13 +00:00
parent c3e590e782
commit a8846756a3
8 changed files with 230 additions and 37 deletions

View File

@@ -12,9 +12,10 @@ export function normalizePath(path) {
.replace(/^[./]+/, "")
.replace(/^\/+/, "")
.replace(/\/{2,}/g, "/")
.trim();
.trim()
.normalize("NFC");
try {
return decodeURI(normalized);
return decodeURI(normalized).normalize("NFC");
} catch {
return normalized;
}
@@ -48,6 +49,15 @@ export function parseStoragePath(rawValue) {
};
}
export function hasWildcard(path) {
return /[*?[\]{}]/.test(String(path ?? ""));
}
export function createCanonicalLocator(storage, path) {
const cleanPath = normalizePath(path);
return `${storage}:${cleanPath}`.normalize("NFC");
}
export function getExtension(path) {
const clean = normalizePath(path);
const index = clean.lastIndexOf(".");
@@ -115,6 +125,6 @@ export function createFileLocator(storage, path) {
return {
storage,
path: cleanPath,
locator: `${storage}:${cleanPath}`
locator: createCanonicalLocator(storage, cleanPath)
};
}