Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,28 @@
|
||||
const E2E_LOCAL_PATH_ORIGIN = "https://hivegrid-e2e.invalid";
|
||||
|
||||
export function requireCanonicalE2eLocalPath(value: string, inputName: string): string {
|
||||
let resolved: URL;
|
||||
try {
|
||||
resolved = new URL(value, E2E_LOCAL_PATH_ORIGIN);
|
||||
} catch {
|
||||
throw invalidLocalPath(inputName);
|
||||
}
|
||||
if (
|
||||
!value.startsWith("/") ||
|
||||
value.startsWith("//") ||
|
||||
value.includes("\\") ||
|
||||
value.includes("%") ||
|
||||
/[\u0000-\u001f\u007f]/u.test(value) ||
|
||||
resolved.origin !== E2E_LOCAL_PATH_ORIGIN ||
|
||||
resolved.pathname !== value ||
|
||||
resolved.search ||
|
||||
resolved.hash
|
||||
) {
|
||||
throw invalidLocalPath(inputName);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function invalidLocalPath(inputName: string): Error {
|
||||
return new Error(`${inputName} must be a canonical app-local absolute path without query or fragment.`);
|
||||
}
|
||||
Reference in new issue
Block a user