fix(workflows): preserve punctuation in filesystem source paths (#521)

* fix(workflows): preserve punctuation in filesystem source paths

Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com>

* fix(workflows): share scheme URL pattern in path normalization

---------

Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Rudy Mizrahi Celekli
2026-10-05 15:01:12 +08:00
committed by GitHub
co-authored by morluto
parent 056c123759
commit 5b28a8b331
3 changed files with 149 additions and 2 deletions
+9 -2
View File
@@ -268,9 +268,16 @@ const addPath = (
if (value !== null) paths.push({ kind, value });
};
/** Matches a `scheme://...` URL prefix; bare filesystem paths keep `?`/`#`. */
const SCHEME_URL = /^[a-z][a-z0-9+.-]*:\/\//iu;
/** Matches a `scheme://...` URL prefix with any run of slashes, for stripping. */
const SCHEME_URL_PREFIX = /^[a-z][a-z0-9+.-]*:\/\/+/iu;
const normalizeCurrentPath = (raw: string): string | null => {
const withoutQuery = raw.split(/[?#]/u, 1)[0] ?? "";
const withoutScheme = withoutQuery.replace(/^[a-z][a-z0-9+.-]*:\/\/+/iu, "");
const withoutQuery = SCHEME_URL.test(raw)
? (raw.split(/[?#]/u, 1)[0] ?? "")
: raw;
const withoutScheme = withoutQuery.replace(SCHEME_URL_PREFIX, "");
const parts = withoutScheme
.replaceAll("\\", "/")
.split("/")