aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbpkg/manifest.cxx4
-rw-r--r--libbpkg/manifest.hxx3
-rw-r--r--tests/repository-location/driver.cxx2
3 files changed, 7 insertions, 2 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx
index af2a889..c2d7eee 100644
--- a/libbpkg/manifest.cxx
+++ b/libbpkg/manifest.cxx
@@ -1923,10 +1923,12 @@ namespace bpkg
return scheme_type::file;
}
- // Consider URL as a path if the URL parsing failed.
+ // Consider non-empty URL as a path if the URL parsing failed. If the URL
+ // is empty then leave the basic_url ctor to throw.
//
else if (scheme.empty ())
{
+ if (!url.empty ())
try
{
size_t p (url.find ('#'));
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index 59359b4..72af14c 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -584,6 +584,9 @@ namespace bpkg
// it is absolute and the authority or fragment is present. Otherwise
// represent it as a local path, appending the fragment if present.
//
+ // - repository_url(string) ctor throws invalid_argument exception for an
+ // empty string.
+ //
using repository_url = butl::basic_url<repository_protocol,
repository_url_traits>;
diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx
index 4b4a807..bb55cf9 100644
--- a/tests/repository-location/driver.cxx
+++ b/tests/repository-location/driver.cxx
@@ -231,7 +231,7 @@ namespace bpkg
// Test valid locations.
//
{
- repository_location l (loc (""));
+ repository_location l (repository_url (), repository_type::pkg);
assert (l.string ().empty ());
assert (l.canonical_name ().empty ());
}