Add assertions for SHA256 in fixed case
This commit is contained in:
parent
fd2eb41e64
commit
a5cdf1867e
|
@ -51,10 +51,14 @@ ContentAddress parseContentAddress(std::string_view rawCa) {
|
||||||
auto methodAndHash = rawCa.substr(prefixSeparator+1, string::npos);
|
auto methodAndHash = rawCa.substr(prefixSeparator+1, string::npos);
|
||||||
if (methodAndHash.substr(0,2) == "r:") {
|
if (methodAndHash.substr(0,2) == "r:") {
|
||||||
std::string_view hashRaw = methodAndHash.substr(2,string::npos);
|
std::string_view hashRaw = methodAndHash.substr(2,string::npos);
|
||||||
return FileSystemHash { FileIngestionMethod::Recursive, Hash(string(hashRaw)) };
|
Hash hash = Hash(string(hashRaw));
|
||||||
|
assert(hash.type == HashType::SHA256);
|
||||||
|
return FileSystemHash { FileIngestionMethod::Recursive, hash };
|
||||||
} else {
|
} else {
|
||||||
std::string_view hashRaw = methodAndHash;
|
std::string_view hashRaw = methodAndHash;
|
||||||
return FileSystemHash { FileIngestionMethod::Flat, Hash(string(hashRaw)) };
|
Hash hash = Hash(string(hashRaw));
|
||||||
|
assert(hash.type == HashType::SHA256);
|
||||||
|
return FileSystemHash { FileIngestionMethod::Flat, hash };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw "parseContentAddress: format not recognized; has to be text or fixed";
|
throw "parseContentAddress: format not recognized; has to be text or fixed";
|
||||||
|
|
Loading…
Reference in a new issue