aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbrep/package.hxx5
-rw-r--r--mod/page.cxx38
-rw-r--r--tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gzbin353 -> 353 bytes
-rw-r--r--tests/load/1/stable/packages.manifest4
-rw-r--r--tests/load/1/stable/signature.manifest20
-rw-r--r--tests/load/driver.cxx22
6 files changed, 43 insertions, 46 deletions
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index f59c0d8..c4304f6 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -65,7 +65,10 @@ namespace brep
using bpkg::url;
#pragma db value(url) definition
- #pragma db member(url::value) virtual(string) before access(this) column("")
+ #pragma db member(url::value) virtual(string) before \
+ get(this.string ()) \
+ set(this = brep::url ((?), "" /* comment */)) \
+ column("")
// email
//
diff --git a/mod/page.cxx b/mod/page.cxx
index e03ee4b..706d052 100644
--- a/mod/page.cxx
+++ b/mod/page.cxx
@@ -577,32 +577,26 @@ namespace brep
void TR_URL::
operator() (serializer& s) const
{
- // Strip the URL prefix for the link text.
- //
- // Note that it may not be a valid URL (see bpkg::url).
- //
- // @@ We should probably inherit bpkg::url from butl::url and make sure
- // that it is "rootfull" and the authority is present. Should we also
- // white-list the schema for security reasons? Then the offset will
- // always be: url_.string ().find ("://") + 3.
- //
- size_t p (string::npos);
+ s << TR(CLASS=label_)
+ << TH << label_ << ~TH
+ << TD
+ << SPAN(CLASS="value");
- if (butl::url::traits::find (url_) == 0) // Is it a "rootfull" URL ?
+ // Display HTTP(S) URL as link, striping the scheme prefix for the link
+ // text. Display URL with a different scheme as plain text.
+ //
+ if (casecmp (url_.scheme, "https") == 0 ||
+ casecmp (url_.scheme, "http") == 0)
{
- size_t n (url_.find (":/") + 2);
- if (url_[n] == '/' && url_[n + 1] != '\0') // Has authority?
- p = n + 1;
+ butl::url u (url_);
+ u.scheme.clear ();
+
+ s << A(HREF=url_) << u << ~A;
}
+ else
+ s << url_;
- s << TR(CLASS=label_)
- << TH << label_ << ~TH
- << TD
- << SPAN(CLASS="value")
- << A(HREF=url_)
- << (p != string::npos ? url_.c_str () + p : url_.c_str ())
- << ~A
- << ~SPAN
+ s << ~SPAN
<< SPAN_COMMENT (url_.comment)
<< ~TD
<< ~TR;
diff --git a/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz b/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz
index cb50945..aa5665e 100644
--- a/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz
+++ b/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz
Binary files differ
diff --git a/tests/load/1/stable/packages.manifest b/tests/load/1/stable/packages.manifest
index 2eb96eb..c1d4f1a 100644
--- a/tests/load/1/stable/packages.manifest
+++ b/tests/load/1/stable/packages.manifest
@@ -18,13 +18,13 @@ priority: security
summary: The Foo library
license: MIT
tags: c++, foo
-url: http://www.example.com/foo/
+url: ftp://www.example.com/foo/
email: foo-users@example.com
depends: libmisc [0.1 2.0-) | libmisc [2.0 5.0]
depends: libgenx (0.2 3.0)
depends: libexpat < 5.2 | libexpat (1 5.1]
location: libfoo-1.2.2-alpha.1.tar.gz
-sha256sum: e769cc99fd58a433beb817882cbf9dc04ce0872fbe3f2d9b43d9f627e67a85ea
+sha256sum: f5d3e9e6e8f9621a638b1375d31f0eb50e6279d8066170b25da21e84198cfd82
:
name: libfoo
version: 1.2.2
diff --git a/tests/load/1/stable/signature.manifest b/tests/load/1/stable/signature.manifest
index d9cb1f8..931ecd4 100644
--- a/tests/load/1/stable/signature.manifest
+++ b/tests/load/1/stable/signature.manifest
@@ -1,13 +1,13 @@
: 1
-sha256sum: 83677600921f649fb98cdc5eef918dc14759e380fcc52e06c471f88ab3aa4907
+sha256sum: 880d24ea372048c9d250410d747b330503bdf216df70e3ea11ad6aef7a58b7b9
signature: \
-JAdvW0tgOj2mJec3Bn9gD85MfLtKn0Eczq9zrpb0iNwWTFA1pwN/cInUclaorKJfj3JyZ6jt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CIp7ZMvcOArfOFzqOTMPOptF0JKUIoC
+v+dzrrzHTA7duu9g+CT5Ag0WKLR0g+Izq3zyQa6YvOAdTFgUaPzd3W7NWP6N+YNeCc8jzGpCdFHY
+1vvDHdNuKVNjSlUtXU5jjJglH2qgnct5SCav76lCKmQBF5PNznwp8R/mb5amIGBOzfRlB9ZN/fSL
+XBM66Z5ObCDViMAliO4RBzoVnSv0y2SwpW+phqrSOzFTm+tDZE63oNh802yf+9/PHcIe48nMuhk=
\
diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx
index 7012660..4f075aa 100644
--- a/tests/load/driver.cxx
+++ b/tests/load/driver.cxx
@@ -416,7 +416,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv2->summary == "The Foo library");
assert (fpv2->tags == strings ({"c++", "foo"}));
assert (!fpv2->description);
- assert (fpv2->url && *fpv2->url == "http://www.example.com/foo/");
+ assert (fpv2->url && fpv2->url->string () == "http://www.example.com/foo/");
assert (!fpv2->package_url);
assert (fpv2->email && *fpv2->email == "foo-users@example.com");
assert (!fpv2->package_email);
@@ -460,7 +460,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv2a->summary == "The Foo library");
assert (fpv2a->tags == strings ({"c++", "foo"}));
assert (!fpv2a->description);
- assert (fpv2a->url && *fpv2a->url == "http://www.example.com/foo/");
+ assert (fpv2a->url && fpv2a->url->string () == "ftp://www.example.com/foo/");
assert (!fpv2a->package_url);
assert (fpv2a->email && *fpv2a->email == "foo-users@example.com");
assert (!fpv2a->package_email);
@@ -509,7 +509,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (check_location (fpv2a));
assert (fpv2a->sha256sum && *fpv2a->sha256sum ==
- "e769cc99fd58a433beb817882cbf9dc04ce0872fbe3f2d9b43d9f627e67a85ea");
+ "f5d3e9e6e8f9621a638b1375d31f0eb50e6279d8066170b25da21e84198cfd82");
// libfoo-1.2.3-4
//
@@ -520,7 +520,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv3->summary == "The Foo library");
assert (fpv3->tags == strings ({"c++", "foo"}));
assert (!fpv3->description);
- assert (fpv3->url && *fpv3->url == "http://www.example.com/foo/");
+ assert (fpv3->url && fpv3->url->string () == "http://www.example.com/foo/");
assert (!fpv3->package_url);
assert (fpv3->email && *fpv3->email == "foo-users@example.com");
assert (!fpv3->package_email);
@@ -556,7 +556,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv4->summary == "The Foo Library");
assert (fpv4->tags == strings ({"c++", "foo"}));
assert (*fpv4->description == "Very good foo library.");
- assert (fpv4->url && *fpv4->url == "http://www.example.com/foo/");
+ assert (fpv4->url && fpv4->url->string () == "http://www.example.com/foo/");
assert (!fpv4->package_url);
assert (fpv4->email && *fpv4->email == "foo-users@example.com");
assert (!fpv4->package_email);
@@ -626,7 +626,7 @@ test_pkg_repos (const cstrings& loader_args,
"pull", "streaming", "modern"}));
assert (!xpv->description);
assert (xpv->url &&
- *xpv->url == "http://www.codesynthesis.com/projects/libstudxml/");
+ xpv->url->string () == "http://www.codesynthesis.com/projects/libstudxml/");
assert (!xpv->package_url);
assert (xpv->email && *xpv->email == email ("studxml-users@example.com",
"Public mailing list, posts by non-members "
@@ -686,18 +686,18 @@ test_pkg_repos (const cstrings& loader_args,
"~~mathlab~~ **MATLAB**.\n\nUseful for conversion of research "
"code into production environments.");
- assert (fpv5->url && *fpv5->url == "http://www.example.com/foo/");
+ assert (fpv5->url && fpv5->url->string () == "http://www.example.com/foo/");
- assert (fpv5->doc_url && *fpv5->doc_url ==
+ assert (fpv5->doc_url && fpv5->doc_url->string () ==
"http://www.example.org/projects/libfoo/man.xhtml" &&
fpv5->doc_url->comment == "Documentation page.");
- assert (fpv5->src_url && *fpv5->src_url ==
+ assert (fpv5->src_url && fpv5->src_url->string () ==
"http://scm.example.com/?p=odb/libodb.git;a=tree" &&
fpv5->src_url->comment == "Source tree url.");
assert (fpv5->package_url &&
- *fpv5->package_url == "http://www.example.com/foo/pack");
+ fpv5->package_url->string () == "http://www.example.com/foo/pack");
assert (fpv5->email && *fpv5->email == "foo-users@example.com");
assert (fpv5->package_email &&
*fpv5->package_email == "pack@example.com");
@@ -798,7 +798,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (epv->tags == strings ({"mathlab", "c++", "exponent"}));
assert (epv->description && *epv->description ==
"The exponent math function.");
- assert (epv->url && *epv->url == "http://exp.example.com");
+ assert (epv->url && epv->url->string () == "http://exp.example.com");
assert (!epv->package_url);
assert (epv->email && *epv->email == email ("users@exp.example.com"));
assert (!epv->package_email);