Added check to make sure hash is valid hex (#153)

This commit is contained in:
deep
2024-11-03 09:49:33 +00:00
committed by GitHub
parent 87c0295f93
commit d02ee3ed24
+8
View File
@@ -550,6 +550,14 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
algo.push_back(ch);
}
key = "URL_HASH";
if (value.empty()) {
throw_key_error("Empty hash value", argItr.first, argItr.second);
}
for (char c : value) {
if (!std::isxdigit(c)) {
throw_key_error("Hash value must be a hex string", argItr.first, argItr.second);
}
}
value = algo + "=" + value;
} else if (key == "hash") {
key = "URL_HASH";