aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-07-05 14:00:35 +0200
committerGitHub <noreply@github.com>2021-07-05 14:00:35 +0200
commitcee426cc015f0eb7573bfbed298e08705f1634c6 (patch)
tree624b25146cf6370564b29606a6a0ffe571fc0583 /src/libstore
parent24bc9354627b3b6d65efb9bb18faa57d681624db (diff)
parente3d11f9a9ca8cf1663de0182154683db250df095 (diff)
Merge pull request #4938 from tomcur/store-uri-parsing
Improve machine store URI parsing
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/machines.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc
index b42e5e434..9843ccf04 100644
--- a/src/libstore/machines.cc
+++ b/src/libstore/machines.cc
@@ -16,13 +16,18 @@ Machine::Machine(decltype(storeUri) storeUri,
decltype(mandatoryFeatures) mandatoryFeatures,
decltype(sshPublicHostKey) sshPublicHostKey) :
storeUri(
- // Backwards compatibility: if the URI is a hostname,
- // prepend ssh://.
+ // Backwards compatibility: if the URI is schemeless, is not a path,
+ // and is not one of the special store connection words, prepend
+ // ssh://.
storeUri.find("://") != std::string::npos
- || hasPrefix(storeUri, "local")
- || hasPrefix(storeUri, "remote")
- || hasPrefix(storeUri, "auto")
- || hasPrefix(storeUri, "/")
+ || storeUri.find("/") != std::string::npos
+ || storeUri == "auto"
+ || storeUri == "daemon"
+ || storeUri == "local"
+ || hasPrefix(storeUri, "auto?")
+ || hasPrefix(storeUri, "daemon?")
+ || hasPrefix(storeUri, "local?")
+ || hasPrefix(storeUri, "?")
? storeUri
: "ssh://" + storeUri),
systemTypes(systemTypes),