Index: openacs-4/packages/acs-templating/acs-templating.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/acs-templating.info,v
diff -u -r1.66.2.9 -r1.66.2.10
--- openacs-4/packages/acs-templating/acs-templating.info 18 Mar 2021 16:51:42 -0000 1.66.2.9
+++ openacs-4/packages/acs-templating/acs-templating.info 1 Jul 2021 13:54:55 -0000 1.66.2.10
@@ -9,7 +9,7 @@
f
t
-
+
OpenACS
Templating library.
2019-01-23
@@ -27,9 +27,9 @@
GPL version 2
3
-
+
-
+
Index: openacs-4/packages/acs-templating/tcl/data-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/data-procs.tcl,v
diff -u -r1.23.2.10 -r1.23.2.11
--- openacs-4/packages/acs-templating/tcl/data-procs.tcl 30 Jun 2021 08:26:18 -0000 1.23.2.10
+++ openacs-4/packages/acs-templating/tcl/data-procs.tcl 1 Jul 2021 13:54:56 -0000 1.23.2.11
@@ -276,8 +276,7 @@
upvar 2 $message_ref message $value_ref value
- set expr {^(https?://)?([a-zA-Z0-9_\-\.]+(:[0-9]+)?)?[a-zA-Z0-9_.%/?=&-]+$}
- set result [regexp $expr $value]
+ set result [util_url_valid_p -relative $value]
if { ! $result } {
set message "[_ acs-templating.Invalid_url] \"[ns_quotehtml $value]\""
Index: openacs-4/packages/acs-templating/tcl/test/data-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/test/data-procs.tcl,v
diff -u -r1.1.2.24 -r1.1.2.25
--- openacs-4/packages/acs-templating/tcl/test/data-procs.tcl 30 Jun 2021 08:54:47 -0000 1.1.2.24
+++ openacs-4/packages/acs-templating/tcl/test/data-procs.tcl 1 Jul 2021 13:54:56 -0000 1.1.2.25
@@ -386,17 +386,105 @@
@creation-date 28 June 2021
} {
set url_true {
- http://la.la
- https://la.la
- https://a.a
- no-protocol
- /relative
+ "http://la.la"
+ "https://la.la"
+ "https://a.a"
+ "http://example.com"
+ "https://example.com"
+ "ftp://example.com"
+ "http://example.com/"
+ "http://example.com/index.html"
+ "HTTP://example.com"
+ "http://example.com/foo/bar/blah"
+ "http://example.com?foo=bar&bar=foo"
+ "http://foo.com/blah_blah"
+ "http://foo.com/blah_blah/"
+ "http://foo.com/blah_blah_(wikipedia)"
+ "http://foo.com/blah_blah_(wikipedia)_(again)"
+ "http://www.example.com/wpstyle/?p=364"
+ "https://www.example.com/foo/?bar=baz&inga=42&quux"
+ "http://✪df.ws/123"
+ "http://userid:password@example.com:8080"
+ "http://userid:password@example.com:8080/"
+ "http://userid@example.com"
+ "http://userid@example.com/"
+ "http://userid@example.com:8080"
+ "http://userid@example.com:8080/"
+ "http://userid:password@example.com"
+ "http://userid:password@example.com/"
+ "http://142.42.1.1/"
+ "http://142.42.1.1:8080/"
+ "http://➡.ws/䨹"
+ "http://⌘.ws"
+ "http://⌘.ws/"
+ "http://foo.com/blah_(wikipedia)#cite-1"
+ "http://foo.com/blah_(wikipedia)_blah#cite-1"
+ "http://foo.com/unicode_(✪)_in_parens"
+ "http://foo.com/(something)?after=parens"
+ "http://☺.damowmow.com/"
+ "http://code.google.com/events/#&product=browser"
+ "http://j.mp"
+ "ftp://foo.bar/baz"
+ "http://foo.bar/?q=Test%20URL-encoded%20stuff"
+ "http://مثال.إختبار"
+ "http://例子.测试"
+ "http://उदाहरण.परीक्षा"
+ "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com"
+ "http://1337.net"
+ "http://a.b-c.de"
+ "http://223.255.255.254"
+ "/"
+ "foo"
+ "/foo/"
+ "/foo/bar"
+ "/foo/bar/"
+ "/foo/bar/lol.html"
+ "/foo.bar/?q=Test%20URL-encoded%20stuff"
+ "foo.com"
+ "foo.com/bar/lol"
+ "/foo.com/bar/lol"
+ "/مثال.إختبار"
+ "/例子.测试"
+ "/उदाहरण.परीक्षा"
+ "/-.~_!$&'()*+,;=:%40:80%2f::::::@example.com"
+ "foo.bar/?q=Test%20URL-encoded%20stuff"
+ "مثال.إختبار"
+ "例子.测试"
+ "उदाहरण.परीक्षा"
+ "-.~_!$&'()*+,;=:%40:80%2f::::::@example.com"
+ "no-protocol"
+ "/relative"
}
set url_false {
- not,valid
+ "http://"
+ "http://."
+ "http://.."
+ "http://../"
+ "http://?"
+ "http://??"
+ "http://??/"
+ "http://#"
+ "http://##"
+ "http://##/"
+ "http://foo.bar?q=Spaces should be encoded"
+ "xhttp://example.com"
+ "httpx://example.com"
+ "wysiwyg://example.com"
+ "mailto:joe@example.com"
+ "//"
+ "//a"
+ "///a"
+ "///"
+ "http:///a"
+ "rdar://1234"
+ "h://test"
+ "http:// shouldfail.com"
+ ":// should fail"
+ "http://foo.bar/foo(bar)baz quux"
+ "ftps://foo.bar/"
+ "http://.www.foo.bar/"
+ "http://.www.foo.bar./"
"la la la"
- ftp://lala.la
- https://
}
set message ""
foreach value $url_true {