bito-code-review[bot] commented on code in PR #40546:
URL: https://github.com/apache/superset/pull/40546#discussion_r3329076424


##########
superset-frontend/src/utils/navigationUtils.ts:
##########
@@ -25,9 +26,9 @@ export const navigateTo = (
   if (options?.newWindow) {
     window.open(ensureAppRoot(url), '_blank', 'noopener noreferrer');
   } else if (options?.assign) {
-    window.location.assign(ensureAppRoot(url));
+    window.location.assign(sanitizeUrl(ensureAppRoot(url)));
   } else {
-    window.location.href = ensureAppRoot(url);
+    window.location.href = sanitizeUrl(ensureAppRoot(url));
   }

Review Comment:
   <!-- Bito Reply -->
   The suggestion in the `newWindow` branch was to apply `sanitizeUrl` 
consistently across all navigation paths. The fix implemented adds 
`sanitizeUrl` to the `newWindow` branch, aligning it with the `assign` and 
`href` branches. This ensures consistent URL sanitization behavior across all 
navigation options, improving predictability for callers.
   
   **superset-frontend/src/utils/navigationUtils.ts**
   ```
   export const navigateTo = (
     url: string,
     options?: { newWindow?: boolean; assign?: boolean }
   ): void => {
     if (options?.newWindow) {
       window.open(ensureAppRoot(url), '_blank', 'noopener noreferrer');
     } else if (options?.assign) {
       window.location.assign(sanitizeUrl(ensureAppRoot(url)));
     } else {
       window.location.href = sanitizeUrl(ensureAppRoot(url));
     }
   };
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to