]> git.proxmox.com Git - mirror_novnc.git/commitdiff
webutil.js: use decodeURIComponent on getQueryVar values.
authorJoel Martin <github@martintribe.org>
Tue, 21 Aug 2012 14:46:11 +0000 (09:46 -0500)
committerJoel Martin <github@martintribe.org>
Tue, 21 Aug 2012 14:46:11 +0000 (09:46 -0500)
include/webutil.js

index 6722fe3863ba68dbbaae9e6857afcbf53a3a77cc..fd153e4a05a9d6ee0047826fb0d272b8ff4eb1d2 100644 (file)
@@ -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;
+    }
 };