mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 01:09:37 +01:00
Merge remote-tracking branch 'origin/master' into configs
This commit is contained in:
commit
d28c7b0982
2 changed files with 9 additions and 5 deletions
|
|
@ -391,7 +391,8 @@ Value & AttrCursor::forceValue()
|
||||||
|
|
||||||
if (root->db && (!cachedValue || std::get_if<placeholder_t>(&cachedValue->second))) {
|
if (root->db && (!cachedValue || std::get_if<placeholder_t>(&cachedValue->second))) {
|
||||||
if (v.type == tString)
|
if (v.type == tString)
|
||||||
cachedValue = {root->db->setString(getKey(), v.string.s, v.string.context), v.string.s};
|
cachedValue = {root->db->setString(getKey(), v.string.s, v.string.context),
|
||||||
|
string_t{v.string.s, {}}};
|
||||||
else if (v.type == tPath)
|
else if (v.type == tPath)
|
||||||
cachedValue = {root->db->setString(getKey(), v.path), v.path};
|
cachedValue = {root->db->setString(getKey(), v.path), v.path};
|
||||||
else if (v.type == tBool)
|
else if (v.type == tBool)
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ protected:
|
||||||
checkEnabled();
|
checkEnabled();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileTransferRequest request(cacheUri + "/" + path);
|
FileTransferRequest request(makeRequest(path));
|
||||||
request.head = true;
|
request.head = true;
|
||||||
getFileTransfer()->download(request);
|
getFileTransfer()->download(request);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -103,7 +103,7 @@ protected:
|
||||||
std::shared_ptr<std::basic_iostream<char>> istream,
|
std::shared_ptr<std::basic_iostream<char>> istream,
|
||||||
const std::string & mimeType) override
|
const std::string & mimeType) override
|
||||||
{
|
{
|
||||||
auto req = FileTransferRequest(cacheUri + "/" + path);
|
auto req = makeRequest(path);
|
||||||
req.data = std::make_shared<string>(StreamToSourceAdapter(istream).drain());
|
req.data = std::make_shared<string>(StreamToSourceAdapter(istream).drain());
|
||||||
req.mimeType = mimeType;
|
req.mimeType = mimeType;
|
||||||
try {
|
try {
|
||||||
|
|
@ -115,8 +115,11 @@ protected:
|
||||||
|
|
||||||
FileTransferRequest makeRequest(const std::string & path)
|
FileTransferRequest makeRequest(const std::string & path)
|
||||||
{
|
{
|
||||||
FileTransferRequest request(cacheUri + "/" + path);
|
return FileTransferRequest(
|
||||||
return request;
|
hasPrefix(path, "https://") || hasPrefix(path, "http://") || hasPrefix(path, "file://")
|
||||||
|
? path
|
||||||
|
: cacheUri + "/" + path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getFile(const std::string & path, Sink & sink) override
|
void getFile(const std::string & path, Sink & sink) override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue