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

Hash::parseSRI add explicit XP settings parameter

This will be used for unit testing.
This commit is contained in:
John Ericson 2025-12-08 15:38:48 -05:00
parent 907a5761fa
commit 14feb36cd6
2 changed files with 5 additions and 4 deletions

View file

@ -164,7 +164,7 @@ static Hash parseLowLevel(
return res;
}
Hash Hash::parseSRI(std::string_view original)
Hash Hash::parseSRI(std::string_view original, const ExperimentalFeatureSettings & xpSettings)
{
auto rest = original;
@ -172,9 +172,9 @@ Hash Hash::parseSRI(std::string_view original)
auto hashRaw = splitPrefixTo(rest, '-');
if (!hashRaw)
throw BadHash("hash '%s' is not SRI", original);
HashAlgorithm parsedType = parseHashAlgo(*hashRaw);
HashAlgorithm parsedType = parseHashAlgo(*hashRaw, xpSettings);
return parseLowLevel(rest, parsedType, {base64::decode, "SRI"});
return parseLowLevel(rest, parsedType, {base64::decode, "SRI"}, xpSettings);
}
/**

View file

@ -110,7 +110,8 @@ struct Hash
HashFormat explicitFormat,
const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
static Hash parseSRI(std::string_view original);
static Hash
parseSRI(std::string_view original, const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
public:
/**