fix: alerts links are broken when there is a space in value (#6043)

* fix: space between values being converted as + sign in alerts generated links

* fix: added inline comment

* fix: added inline comment
This commit is contained in:
Vikrant Gupta 2024-09-20 18:12:16 +05:30 committed by GitHub
parent f6d3f95768
commit 0218f701b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,11 @@ export const useGetCompositeQueryParam = (): Query | null => {
try {
if (!compositeQuery) return null;
parsedCompositeQuery = JSON.parse(decodeURIComponent(compositeQuery));
// MDN reference - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#decoding_query_parameters_from_a_url
// MDN reference to support + characters using encoding - https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams#preserving_plus_signs add later
parsedCompositeQuery = JSON.parse(
decodeURIComponent(compositeQuery.replace(/\+/g, ' ')),
);
} catch (e) {
parsedCompositeQuery = null;
}