diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/hash.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc index 00bb999cb..35a449530 100644 --- a/src/libutil/hash.cc +++ b/src/libutil/hash.cc @@ -140,19 +140,20 @@ Hash::Hash(std::string_view s, std::optional<HashType> optType) // Find the : or - separater, and set `isSRI` to the correct value auto sep = s.find(':'); - if (sep == string::npos) { + if (sep == std::string_view::npos) { sep = s.find('-'); - if (sep != string::npos) + if (sep != std::string_view::npos) isSRI = true; } // Parse the has type before the separater, if there was one. std::optional<HashType> optParsedType; - if (sep != string::npos) { + if (sep != std::string_view::npos) { auto hts = s.substr(0, sep); - auto optParsedType = parseHashType(hts); + auto optParsedType = parseHashTypeOpt(hts); if (!optParsedType) throw BadHash("unknown hash type '%s'", hts); + pos = sep + 1; } // Either the string or user must provide the type, if they both do they |