Skip to content

Fix logic error preventing allowed iframe query parameters from being preserved#5295

Open
DAQEM wants to merge 1 commit intomodrinth:mainfrom
DAQEM:main
Open

Fix logic error preventing allowed iframe query parameters from being preserved#5295
DAQEM wants to merge 1 commit intomodrinth:mainfrom
DAQEM:main

Conversation

@DAQEM
Copy link

@DAQEM DAQEM commented Feb 4, 2026

This PR fixes a logic bug in the iframe src sanitizer where allowed query parameters (e.g., start, end, id) were being incorrectly stripped.

The Issue:
Previously, newSearchParams was initialized as an empty object. The filtering loop attempted to delete disallowed keys from this already empty object, which had no effect. Consequently, the final url.search was always set to an empty string, removing all parameters.

The Fix:
We now initialize newSearchParams with the existing parameters from the URL. This ensures that the .delete() operation correctly removes only the disallowed parameters while keeping the allowed ones.

@IMB11 IMB11 added 📂 Under review [Triage] Is being reviewed by Modrinth Staff for future roadmap consideration. frontend Involves work from the frontend team labels Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Involves work from the frontend team 📂 Under review [Triage] Is being reviewed by Modrinth Staff for future roadmap consideration.

Development

Successfully merging this pull request may close these issues.

2 participants