mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
Merge pull request #8845 from cole-h/fix-double-percent-encoding
libutil: fix double-encoding of URLs
This commit is contained in:
commit
735558bea6
2 changed files with 23 additions and 1 deletions
22
src/libexpr/tests/flakeref.cc
Normal file
22
src/libexpr/tests/flakeref.cc
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include "flake/flakeref.hh"
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
|
||||||
|
/* ----------- tests for flake/flakeref.hh --------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* to_string
|
||||||
|
* --------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
TEST(to_string, doesntReencodeUrl) {
|
||||||
|
auto s = "http://localhost:8181/test/+3d.tar.gz";
|
||||||
|
auto flakeref = parseFlakeRef(s);
|
||||||
|
auto parsed = flakeref.to_string();
|
||||||
|
auto expected = "http://localhost:8181/test/%2B3d.tar.gz";
|
||||||
|
|
||||||
|
ASSERT_EQ(parsed, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ ParsedURL parseURL(const std::string & url)
|
||||||
.base = base,
|
.base = base,
|
||||||
.scheme = scheme,
|
.scheme = scheme,
|
||||||
.authority = authority,
|
.authority = authority,
|
||||||
.path = path,
|
.path = percentDecode(path),
|
||||||
.query = decodeQuery(query),
|
.query = decodeQuery(query),
|
||||||
.fragment = percentDecode(std::string(fragment))
|
.fragment = percentDecode(std::string(fragment))
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue