mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
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 ('').
This commit is contained in:
parent
1e9d523046
commit
c80c5ad958
1 changed files with 4 additions and 3 deletions
|
|
@ -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')
|
||||
)||'';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue