1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

Use isAbsolute()

(cherry picked from commit ff9d886f3c)
This commit is contained in:
Eelco Dolstra 2025-01-14 17:42:26 +01:00 committed by Mergify
parent 0b57e7daf5
commit 639f526405
7 changed files with 12 additions and 12 deletions

View file

@ -177,7 +177,7 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
}
} else {
if (!hasPrefix(path, "/"))
if (!isAbsolute(path))
throw BadURL("flake reference '%s' is not an absolute path", url);
path = canonPath(path + "/" + getOr(query, "dir", ""));
}
@ -234,7 +234,7 @@ std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
auto parsed = parseURL(url);
if (baseDir
&& (parsed.scheme == "path" || parsed.scheme == "git+file")
&& !hasPrefix(parsed.path, "/"))
&& !isAbsolute(parsed.path))
parsed.path = absPath(parsed.path, *baseDir);
return fromParsedURL(fetchSettings, std::move(parsed), isFlake);
} catch (BadURL &) {