Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around the workaround: deal with querystrings in zimit2 ZIMs where the URL separators have been encoded #1229

Closed
Jaifroid opened this issue Mar 14, 2024 · 1 comment · Fixed by #1230
Assignees
Labels
backend bug zimit Code relating to the support of Zimit-style archives
Milestone

Comments

@Jaifroid
Copy link
Member

Jaifroid commented Mar 14, 2024

Pending the outcome of openzim/libzim#865, we may need to introduce a workaround in Kiwix JS readers.

See original issue for full detail, but the summary is that, on HTML pages that have been encoded by warc2zim2, querystrings are incorrectly presented with encoded separators (whereas those separators are not encoded in the ZIM URL). For example, index.html?thematique=internet might be presented as index.html%3Fthematique%3Dinternet. This currently causes KJS to fail, as it (correctly) does decodeURI() when converting the HTML representation to a ZIM URL, not decodeURIComponent().

If we decode the URI separators as well, then we could be left with anomalous situations like what_is_a_cookie?.html?title=What is a cookie?&theme=dark. So we will have to take care in such situations with how we handle the querystring.

@Jaifroid Jaifroid added bug backend zimit Code relating to the support of Zimit-style archives labels Mar 14, 2024
@Jaifroid Jaifroid added this to the v4.1 milestone Mar 14, 2024
@Jaifroid Jaifroid self-assigned this Mar 14, 2024
@Jaifroid
Copy link
Member Author

Interestingly, the given example in openzim/libzim#865 works in Safe Mode, probably because we decodeURICompenent() the entire URL string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug zimit Code relating to the support of Zimit-style archives
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant