aboutsummaryrefslogtreecommitdiff
path: root/web/public
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-01-14 22:12:32 +0100
committerJochen Topf <jochen@topf.org>2013-01-14 22:12:32 +0100
commit9d732da11731a0162839eca98b5de19f76e661a7 (patch)
tree1f53d7848d9c749374881f5f81ce433f03982ee7 /web/public
parent163d8e62433eb6d0d14910525d4900aab57de567 (diff)
downloadtaginfo-9d732da11731a0162839eca98b5de19f76e661a7.tar
taginfo-9d732da11731a0162839eca98b5de19f76e661a7.tar.gz
Improve regex for bad chars in url paths
Diffstat (limited to 'web/public')
-rw-r--r--web/public/js/taginfo.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js
index 5908c2d..8846898 100644
--- a/web/public/js/taginfo.js
+++ b/web/public/js/taginfo.js
@@ -195,9 +195,11 @@ function html_escape(text) {
return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
}
+var bad_chars_for_url = /[.=\/]/;
+
function url_for_key(key) {
var k = encodeURIComponent(key);
- if (key.match(/[=\/]/)) {
+ if (key.match(bad_chars_for_url)) {
return '/keys/?key=' + k;
} else {
return '/keys/' + k;
@@ -207,7 +209,7 @@ function url_for_key(key) {
function url_for_tag(key, value) {
var k = encodeURIComponent(key),
v = encodeURIComponent(value);
- if (key.match(/[=\/]/) || value.match(/[=\/]/)) {
+ if (key.match(bad_chars_for_url) || value.match(bad_chars_for_url)) {
return '/tags/?key=' + k + '&value=' + v;
} else {
return '/tags/' + k + '=' + v;
@@ -216,7 +218,7 @@ function url_for_tag(key, value) {
function url_for_rtype(rtype) {
var t = encodeURIComponent(rtype);
- if (rtype.match(/[=\/]/)) {
+ if (rtype.match(bad_chars_for_url)) {
return '/relations/?rtype=' + t;
} else {
return '/relations/' + t;