diff options
author | Simon Eisenmann <simon@struktur.de> | 2016-09-16 16:03:15 +0200 |
---|---|---|
committer | Simon Eisenmann <simon@struktur.de> | 2016-09-16 16:11:08 +0200 |
commit | c80c5ad9588ff71e92bfa43e6089e671f9ec8039 (patch) | |
tree | 23fd8a0012c38b8475a3026052d9a28982385da6 /core | |
parent | 1e9d52304633eed8ad97a1764f4a19cbc6c2b9ed (diff) | |
download | nextcloud-server-c80c5ad9588ff71e92bfa43e6089e671f9ec8039.tar.gz nextcloud-server-c80c5ad9588ff71e92bfa43e6089e671f9ec8039.zip |
Fixup getURLParameter behavior
This commit further changes the behavior of getURLParmeter to handle
encoded parameter values and returns the decoded string and improves
behavior for parameters without value and multiple equals and other
similar cases which did not work before. See the comments at
http://stackoverflow.com/questions/1403888/get-escaped-url-parameter for
a list of the issues handled by the updated implementation.
This change does not change the general behavior of the function. Empty
or non existing parameters still return an empty string ('').
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/js/js.js b/core/js/js.js index 0a83f1104aa..67487ec979c 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1722,9 +1722,10 @@ function formatDate(timestamp){ * @return {string} */ function getURLParameter(name) { - return decodeURI( - (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || [, ''])[1] - ); + return decodeURIComponent( + (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec( + location.search)||[,''])[1].replace(/\+/g, '%20') + )||''; } /** |