aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/url.cc
diff options
context:
space:
mode:
authorEric Wolf <ericwolf42@gmail.com>2023-01-20 10:31:26 +0100
committerEric Wolf <ericwolf42@gmail.com>2023-01-20 10:31:26 +0100
commit4d50995effdaf1d04453293d1afa56e9c8ce6f24 (patch)
tree8afdf6167ce762a3d62417b5855c5f99eb395e41 /src/libutil/url.cc
parentb911307d7ae12260f6ace7c7b1cfb5f1e92f894f (diff)
Fix url parsing for urls using `file+`
`file+https://example.org/test.mp4` should not be rejected with `unexpected authority`.
Diffstat (limited to 'src/libutil/url.cc')
-rw-r--r--src/libutil/url.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/url.cc b/src/libutil/url.cc
index 5b7abeb49..4e43455e1 100644
--- a/src/libutil/url.cc
+++ b/src/libutil/url.cc
@@ -30,13 +30,13 @@ ParsedURL parseURL(const std::string & url)
auto & query = match[6];
auto & fragment = match[7];
- auto isFile = scheme.find("file") != std::string::npos;
+ auto transportIsFile = parseUrlScheme(scheme).transport == "file";
- if (authority && *authority != "" && isFile)
+ if (authority && *authority != "" && transportIsFile)
throw BadURL("file:// URL '%s' has unexpected authority '%s'",
url, *authority);
- if (isFile && path.empty())
+ if (transportIsFile && path.empty())
path = "/";
return ParsedURL{