summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2012-08-21 09:46:11 -0500
committerJoel Martin <github@martintribe.org>2012-08-21 09:46:11 -0500
commitfa5b334dcbe7a5dab21580b54cc2f5f142600379 (patch)
tree328323278b13f589787bd6a38e0c07b7d81d2486
parentfcff386b926ad774cb4f7cf4e947a66b1c5580e3 (diff)
downloadnovnc-fa5b334dcbe7a5dab21580b54cc2f5f142600379.tar.gz
webutil.js: use decodeURIComponent on getQueryVar values.
-rw-r--r--include/webutil.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/webutil.js b/include/webutil.js
index 6722fe3..fd153e4 100644
--- a/include/webutil.js
+++ b/include/webutil.js
@@ -75,9 +75,14 @@ WebUtil.dirObj = function (obj, depth, parent) {
// Read a query string variable
WebUtil.getQueryVar = function(name, defVal) {
- var re = new RegExp('[?][^#]*' + name + '=([^&#]*)');
+ var re = new RegExp('[?][^#]*' + name + '=([^&#]*)'),
+ match = document.location.href.match(re);
if (typeof defVal === 'undefined') { defVal = null; }
- return (document.location.href.match(re) || ['',defVal])[1];
+ if (match) {
+ return decodeURIComponent(match[1]);
+ } else {
+ return defVal;
+ }
};