diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-05-26 11:46:42 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-05-26 11:46:42 -0400 |
commit | 0f3f90107174c74e9416c58b5989047dd40fc61f (patch) | |
tree | 5e0d25c902f8ddf906fbad016e5dbd7634037ed9 /src/libstore/store-api.cc | |
parent | c2f33edd1f30f5c7c54780636104bdef318d65db (diff) | |
parent | 3d3c219d917525b0a131c4332dd65eadfc818f49 (diff) |
Merge remote-tracking branch 'origin/master' into more-rust-ffi
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 261afed49..91ba64cfc 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -6,6 +6,7 @@ #include "thread-pool.hh" #include "json.hh" #include "derivations.hh" +#include "url.hh" #include <future> @@ -40,7 +41,7 @@ Path Store::followLinksToStore(std::string_view _path) const path = absPath(target, dirOf(path)); } if (!isInStore(path)) - throw Error(format("path '%1%' is not in the Nix store") % path); + throw NotInStore("path '%1%' is not in the Nix store", path); return path; } @@ -851,27 +852,7 @@ std::pair<std::string, Store::Params> splitUriAndParams(const std::string & uri_ Store::Params params; auto q = uri.find('?'); if (q != std::string::npos) { - for (auto s : tokenizeString<Strings>(uri.substr(q + 1), "&")) { - auto e = s.find('='); - if (e != std::string::npos) { - auto value = s.substr(e + 1); - std::string decoded; - for (size_t i = 0; i < value.size(); ) { - if (value[i] == '%') { - if (i + 2 >= value.size()) - throw Error("invalid URI parameter '%s'", value); - try { - decoded += std::stoul(std::string(value, i + 1, 2), 0, 16); - i += 3; - } catch (...) { - throw Error("invalid URI parameter '%s'", value); - } - } else - decoded += value[i++]; - } - params[s.substr(0, e)] = decoded; - } - } + params = decodeQuery(uri.substr(q + 1)); uri = uri_.substr(0, q); } return {uri, params}; |