1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00

Merge pull request #13795 from xokdvium/factor-out-s3url

libstore: Introduce ParsedS3URL type
This commit is contained in:
John Ericson 2025-08-19 17:28:52 -04:00 committed by GitHub
commit 088cc176f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 212 additions and 28 deletions

View file

@ -30,7 +30,7 @@ struct ParsedURL
};
static Authority parse(std::string_view encodedAuthority);
bool operator==(const Authority & other) const = default;
auto operator<=>(const Authority & other) const = default;
std::string to_string() const;
friend std::ostream & operator<<(std::ostream & os, const Authority & self);
@ -81,7 +81,7 @@ struct ParsedURL
std::string to_string() const;
bool operator==(const ParsedURL & other) const noexcept = default;
auto operator<=>(const ParsedURL & other) const noexcept = default;
/**
* Remove `.` and `..` path elements.
@ -111,7 +111,7 @@ std::string encodeQuery(const StringMap & query);
*
* @throws BadURL
*/
ParsedURL parseURL(const std::string & url);
ParsedURL parseURL(std::string_view url);
/**
* Although thats not really standardized anywhere, an number of tools

View file

@ -108,10 +108,8 @@ static std::string percentEncodeCharSet(std::string_view s, auto charSet)
return res;
}
ParsedURL parseURL(const std::string & url)
ParsedURL parseURL(std::string_view url)
try {
auto unparsedView = url;
/* Account for several non-standard properties of nix urls (for back-compat):
* - Allow unescaped spaces ' ' and '"' characters in queries.
* - Allow '"', ' ' and '^' characters in the fragment component.