diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-14 12:06:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-14 12:06:14 +0000 |
commit | e464f195ff5debc3e9aad0f8c4537404b92019c6 (patch) | |
tree | 9efe381ffb9d8c9bceb3cced1e27b6b59dc6298b /app/assets | |
parent | 5ff1b520badaa2da217416964709f49f3ede350a (diff) | |
download | gitlab-ce-e464f195ff5debc3e9aad0f8c4537404b92019c6.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 7c4373ba517..177ae4f9838 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -177,6 +177,15 @@ export const urlParamsToArray = (path = '') => export const getUrlParamsArray = () => urlParamsToArray(window.location.search); +/** + * Accepts encoding string which includes query params being + * sent to URL. + * + * @param {string} path Query param string + * + * @returns {object} Query params object containing key-value pairs + * with both key and values decoded into plain string. + */ export const urlParamsToObject = (path = '') => splitPath(path).reduce((dataParam, filterParam) => { if (filterParam === '') { @@ -185,6 +194,7 @@ export const urlParamsToObject = (path = '') => const data = dataParam; let [key, value] = filterParam.split('='); + key = /%\w+/g.test(key) ? decodeURIComponent(key) : key; const isArray = key.includes('[]'); key = key.replace('[]', ''); value = decodeURIComponent(value.replace(/\+/g, ' ')); |