Conversation
PM-2524 Fix empty submissions tab for DS F2F
| if (!auth.tokenV3) { | ||
| const utmSource = communityId || 'community-app-main'; | ||
| window.location.href = `${config.URL.AUTH}/member?retUrl=${encodeURIComponent(`${window.location.origin}${window.location.pathname}`)}&utm_source=${utmSource}®Source=challenges`; | ||
| window.location.href = appendUtmParamsToUrl( |
There was a problem hiding this comment.
[❗❗ security]
The appendUtmParamsToUrl function is used to construct a URL with query parameters. Ensure that this function properly encodes all URL components to prevent potential security issues such as URL injection.
|
|
||
| // handle values that might contain '=' | ||
| const cookieValue = decodeURIComponent(cookieStr.split('=').slice(1).join('=')); | ||
| return JSON.parse(cookieValue); |
There was a problem hiding this comment.
[maintainability]
Consider logging the error or handling it in a way that provides more context. Swallowing errors silently can make debugging difficult.
|
|
||
| return urlObj.toString(); | ||
| } catch (error) { | ||
| return url; |
There was a problem hiding this comment.
[maintainability]
Consider logging the error or handling it in a way that provides more context. Swallowing errors silently can make debugging difficult.
| * @param url - The base URL to append parameters to | ||
| * @returns URL with UTM parameters appended, or original URL if no cookie exists | ||
| */ | ||
| export function appendUtmParamsToUrl(url, defaultParams = {}) { |
There was a problem hiding this comment.
[correctness]
The function appendUtmParamsToUrl should validate the url parameter more robustly. Currently, it only checks for falsy values, but malformed URLs could still cause issues.
|
@kkartunov let's close this one |
https://topcoder.atlassian.net/browse/PM-3204