mirror of
https://github.com/NixOS/nix
synced 2025-06-28 05:21:16 +02:00
Merge pull request #7776 from yorickvP/fix-path-escapes-7707
Properly escape local paths into URLs in fetchTree
This commit is contained in:
commit
eae89aca1b
5 changed files with 70 additions and 7 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "fetchers.hh"
|
||||
#include "filetransfer.hh"
|
||||
#include "registry.hh"
|
||||
#include "url.hh"
|
||||
|
||||
#include <ctime>
|
||||
#include <iomanip>
|
||||
|
@ -68,7 +69,16 @@ void emitTreeAttrs(
|
|||
std::string fixURI(std::string uri, EvalState & state, const std::string & defaultScheme = "file")
|
||||
{
|
||||
state.checkURI(uri);
|
||||
return uri.find("://") != std::string::npos ? uri : defaultScheme + "://" + uri;
|
||||
if (uri.find("://") == std::string::npos) {
|
||||
const auto p = ParsedURL {
|
||||
.scheme = defaultScheme,
|
||||
.authority = "",
|
||||
.path = uri
|
||||
};
|
||||
return p.to_string();
|
||||
} else {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
std::string fixURIForGit(std::string uri, EvalState & state)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue