aboutsummaryrefslogtreecommitdiff
path: root/bpkg/manifest-utility.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-03-08 18:14:44 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-03-09 14:54:52 +0300
commit78229192fc54ec1822bb29146f08386e3c60f813 (patch)
tree4e994888280268b33daea557903c2510a0a39905 /bpkg/manifest-utility.cxx
parentbf7f63e56640fa7756ebaacac36fcf23ce61afa3 (diff)
Fix repository_name() to always recognize names for local repositories
Diffstat (limited to 'bpkg/manifest-utility.cxx')
-rw-r--r--bpkg/manifest-utility.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx
index a2b817d..50ee4e8 100644
--- a/bpkg/manifest-utility.cxx
+++ b/bpkg/manifest-utility.cxx
@@ -155,19 +155,25 @@ namespace bpkg
{
size_t p (s.find (':'));
- // If it has no scheme or the scheme looks like that of a URL, then this
- // is not a canonical name.
+ // If it has no scheme, then this is not a canonical name.
//
- if (p == string::npos || butl::url::traits::find (s, p) != string::npos)
+ if (p == string::npos)
return false;
// This is a canonical name if the scheme is convertible to the repository
- // type.
+ // type and is followed by the colon and no more than one slash.
+ //
+ // Note that the approach is valid unless we invent the file scheme for the
+ // canonical name.
//
try
{
- to_repository_type (string (s, 0, p));
- return true;
+ string scheme (s, 0, p);
+ to_repository_type (scheme);
+ bool r (!(p + 2 < s.size () && s[p + 1] == '/' && s[p + 2] == '/'));
+
+ assert (!r || scheme != "file");
+ return r;
}
catch (const invalid_argument&)
{