bito-code-review[bot] commented on PR #44775:
URL: https://github.com/apache/superset/pull/44775#issuecomment-5884981582

   <!-- Bito Reply -->
   The flagged issue is correct. When a URL already contains query parameters 
(like `force=false` in a permalink), appending a new parameter using a simple 
string concatenation or basic URL builder can lead to multiple `force` 
parameters. If the client-side code uses `URLSearchParams.get()`, it will only 
read the first occurrence, causing the intended `force=true` to be ignored.
   
   To resolve this, you should ensure the URL is constructed using a proper URL 
manipulation library that handles parameter merging or replacement correctly, 
rather than simple string appending. In Python, `urllib.parse` can be used to 
parse the URL, update the query parameters, and reconstruct it.
   
   Would you like me to fetch all other comments on this PR to validate and 
implement fixes for them as well?
   
   **superset/commands/report/execute.py**
   ```
   from urllib.parse import urlencode, urlparse, urlunparse, parse_qsl
   
   def update_url_query(url: str, params: dict) -> str:
       parsed = urlparse(url)
       query = dict(parse_qsl(parsed.query))
       query.update(params)
       return urlunparse(parsed._replace(query=urlencode(query)))
   ```


-- 
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