mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
Tighten parsing for drv files and pathinfo
This commit is contained in:
parent
b6b10b1d4c
commit
1fc835aa22
2 changed files with 4 additions and 4 deletions
|
@ -68,7 +68,7 @@ ContentAddress parseContentAddress(std::string_view rawCa) {
|
||||||
throw Error("text content address hash should use %s, but instead uses %s",
|
throw Error("text content address hash should use %s, but instead uses %s",
|
||||||
printHashType(htSHA256), printHashType(hashType));
|
printHashType(htSHA256), printHashType(hashType));
|
||||||
return TextHash {
|
return TextHash {
|
||||||
.hash = Hash::parseAny(rest, std::move(hashType)),
|
.hash = Hash::parseNonSRIUnprefixed(rest, std::move(hashType)),
|
||||||
};
|
};
|
||||||
} else if (prefix == "fixed") {
|
} else if (prefix == "fixed") {
|
||||||
// Parse method
|
// Parse method
|
||||||
|
@ -80,7 +80,7 @@ ContentAddress parseContentAddress(std::string_view rawCa) {
|
||||||
HashType hashType = parseHashType_();
|
HashType hashType = parseHashType_();
|
||||||
return FixedOutputHash {
|
return FixedOutputHash {
|
||||||
.method = method,
|
.method = method,
|
||||||
.hash = Hash::parseAny(rest, std::move(hashType)),
|
.hash = Hash::parseNonSRIUnprefixed(rest, std::move(hashType)),
|
||||||
};
|
};
|
||||||
} else
|
} else
|
||||||
throw UsageError("content address prefix \"%s\" is unrecognized. Recogonized prefixes are \"text\" or \"fixed\"", prefix);
|
throw UsageError("content address prefix \"%s\" is unrecognized. Recogonized prefixes are \"text\" or \"fixed\"", prefix);
|
||||||
|
|
|
@ -118,7 +118,7 @@ static DerivationOutput parseDerivationOutput(const Store & store, istringstream
|
||||||
const HashType hashType = parseHashType(hashAlgo);
|
const HashType hashType = parseHashType(hashAlgo);
|
||||||
fsh = FixedOutputHash {
|
fsh = FixedOutputHash {
|
||||||
.method = std::move(method),
|
.method = std::move(method),
|
||||||
.hash = Hash::parseAny(hash, hashType),
|
.hash = Hash::parseNonSRIUnprefixed(hash, hashType),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ static DerivationOutput readDerivationOutput(Source & in, const Store & store)
|
||||||
auto hashType = parseHashType(hashAlgo);
|
auto hashType = parseHashType(hashAlgo);
|
||||||
fsh = FixedOutputHash {
|
fsh = FixedOutputHash {
|
||||||
.method = std::move(method),
|
.method = std::move(method),
|
||||||
.hash = Hash::parseAny(hash, hashType),
|
.hash = Hash::parseNonSRIUnprefixed(hash, hashType),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue