mirror of
https://github.com/NixOS/nix.git
synced 2025-12-13 12:31:04 +01:00
Hash::parseSRI add explicit XP settings parameter
This will be used for unit testing.
This commit is contained in:
parent
907a5761fa
commit
14feb36cd6
2 changed files with 5 additions and 4 deletions
|
|
@ -164,7 +164,7 @@ static Hash parseLowLevel(
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Hash Hash::parseSRI(std::string_view original)
|
Hash Hash::parseSRI(std::string_view original, const ExperimentalFeatureSettings & xpSettings)
|
||||||
{
|
{
|
||||||
auto rest = original;
|
auto rest = original;
|
||||||
|
|
||||||
|
|
@ -172,9 +172,9 @@ Hash Hash::parseSRI(std::string_view original)
|
||||||
auto hashRaw = splitPrefixTo(rest, '-');
|
auto hashRaw = splitPrefixTo(rest, '-');
|
||||||
if (!hashRaw)
|
if (!hashRaw)
|
||||||
throw BadHash("hash '%s' is not SRI", original);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,8 @@ struct Hash
|
||||||
HashFormat explicitFormat,
|
HashFormat explicitFormat,
|
||||||
const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
|
const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
|
||||||
|
|
||||||
static Hash parseSRI(std::string_view original);
|
static Hash
|
||||||
|
parseSRI(std::string_view original, const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue