summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Schneider2017-11-29 15:59:11 +0100
committerChristian Schneider2017-11-29 15:59:11 +0100
commita5fdef178ddda946429d95616266d8fec7f73a1a (patch)
tree0be9079ecad3d397f9cac1d56ffcac52c8c6596e
parent5d6993d445fe85c5ad1d3adc511ade8672708d8c (diff)
downloaditools-a5fdef178ddda946429d95616266d8fec7f73a1a.tar.gz
itools-a5fdef178ddda946429d95616266d8fec7f73a1a.tar.bz2
itools-a5fdef178ddda946429d95616266d8fec7f73a1a.zip
Do not add / for non-http url without path
-rw-r--r--it_html.class2
-rw-r--r--tests/U_tests.json6
2 files changed, 7 insertions, 1 deletions
diff --git a/it_html.class b/it_html.class
index c75f05e..35a5b11 100644
--- a/it_html.class
+++ b/it_html.class
@@ -569,7 +569,7 @@ static function U(/* ... */)
$u[$key]
);
- if (!$u['path'] && $hostpart)
+ if (!$u['path'] && $hostpart && preg_match('/^(https?)?$/', $u['scheme']))
$u['path'] = '/';
$queryparams = it_url::params($u['params'] + $params);
diff --git a/tests/U_tests.json b/tests/U_tests.json
index d340492..81ceb15 100644
--- a/tests/U_tests.json
+++ b/tests/U_tests.json
@@ -177,5 +177,11 @@
"args": ["http://gna.ch"],
"exp": "http://gna.ch/",
"name": "U() add / for absolute http url without path"
+ },
+
+ {
+ "args": ["app://settings"],
+ "exp": "app://settings",
+ "name": "U() do not add / for non-http url without path"
}
]