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

Fix failure to display URLs ending in question mark #655

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

Jaifroid
Copy link
Member

Fixes #654.

I discovered that Kiwix JS does not exhibit the problem described, and it turns out to be that using encodeURI(), unlike encodeURIComponent() does not encode question marks. The problem here is the need to encode a question mark when it is part of the dirEntry's url or title, as will always be the case in Wikipedia ZIMs. But in fact, because even Zimit does not have a concept of a querystring, even if a querystring is present in the URL, that we always need to encode the full dirEntry.url before placing it in the iframe's location.href field (or redirecting to it in separate tabs). So, we have to use encodeURIComponent() but taking care not to encode forward slashes! This is how Kiwix JS does it, by encoding the parts between forward slashes.

Hopefully this will work in all circumstances and ZIM types, but it does need careful testing.

@Jaifroid Jaifroid added this to the Release 3.5.0 milestone Sep 29, 2024
@Jaifroid Jaifroid self-assigned this Sep 29, 2024
@Jaifroid
Copy link
Member Author

I've tested in OpenZIM, Zimit1 and Zimit2 contexts, and all seems to be working.

@Jaifroid Jaifroid merged commit ab6895f into main Sep 29, 2024
1 check passed
@Jaifroid Jaifroid deleted the Fix-failure-to-display-URLs-ending-in-question-mark branch September 29, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wikipedia titles ending in question mark are not correctly read
1 participant