Improve whitespace handling

This commit is contained in:
Michael B. Gale
2026-06-23 18:42:43 +01:00
parent 00e5a58139
commit 8d69da902e
3 changed files with 70 additions and 12 deletions

16
lib/entry-points.js generated
View File

@@ -151452,21 +151452,25 @@ function parseRemoteFileAddress(env, configFile) {
"^((?<owner>[^/]+)/)?(?<repo>[^/@]+)(/(?<path>[^@]+))?(@(?<ref>.*))?$"
);
const pieces = format.exec(configFile.trim());
if (!pieces?.groups?.repo || pieces.groups.repo.trim().length === 0) {
const repo = pieces?.groups?.repo?.trim();
if (!pieces?.groups || !repo || repo.length === 0) {
throw new ConfigurationError(
getConfigFileRepoFormatInvalidMessage(configFile)
);
}
if (pieces.groups.path?.startsWith("/")) {
const owner = pieces.groups.owner?.trim();
const path29 = pieces.groups.path?.trim();
const ref = pieces.groups.ref?.trim();
if (path29?.startsWith("/")) {
throw new ConfigurationError(
`The path component of '${configFile}' cannot be an absolute path.`
);
}
return {
owner: pieces.groups.owner || getDefaultOwner(env),
repo: pieces.groups.repo.trim(),
path: pieces.groups.path || DEFAULT_CONFIG_FILE_NAME,
ref: pieces.groups.ref || DEFAULT_CONFIG_FILE_REF
owner: owner || getDefaultOwner(env),
repo,
path: path29 || DEFAULT_CONFIG_FILE_NAME,
ref: ref || DEFAULT_CONFIG_FILE_REF
};
}