1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-13 05:56:03 +01:00

Tighten parsing for drv files and pathinfo

This commit is contained in:
Carlo Nucera 2020-07-02 11:57:21 -04:00
parent b6b10b1d4c
commit 1fc835aa22
2 changed files with 4 additions and 4 deletions

View file

@ -68,7 +68,7 @@ ContentAddress parseContentAddress(std::string_view rawCa) {
throw Error("text content address hash should use %s, but instead uses %s",
printHashType(htSHA256), printHashType(hashType));
return TextHash {
.hash = Hash::parseAny(rest, std::move(hashType)),
.hash = Hash::parseNonSRIUnprefixed(rest, std::move(hashType)),
};
} else if (prefix == "fixed") {
// Parse method
@ -80,7 +80,7 @@ ContentAddress parseContentAddress(std::string_view rawCa) {
HashType hashType = parseHashType_();
return FixedOutputHash {
.method = method,
.hash = Hash::parseAny(rest, std::move(hashType)),
.hash = Hash::parseNonSRIUnprefixed(rest, std::move(hashType)),
};
} else
throw UsageError("content address prefix \"%s\" is unrecognized. Recogonized prefixes are \"text\" or \"fixed\"", prefix);