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

Issues in MDN zimit2 ZIM: links are opening online instead of staying in the ZIM #178

Closed
benoit74 opened this issue Feb 9, 2024 · 6 comments
Assignees
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@benoit74
Copy link
Collaborator

benoit74 commented Feb 9, 2024

I made ZIM on my local machine with latest zimit2 image (based on warc2zim 2.0.0-dev3) based on WARC files at https://tmp.kiwix.org/ci/test-warc/developer.mozilla.org_en_2024-02-04/

warc2zim command used to test locally:

warc2zim(["--name=developer.mozilla.org_en_all","--tags=mozilla","--favicon=https://drive.farm.openzim.org/developer.mozilla.org_en/favicon.png","--verbose","--publisher=openZIM","--output","/output","--url","https://developer.mozilla.org/en-US/","--title","MDN Web Docs","--description","Resources for developers, by developers", "."])

A ZIM is produced successfully, but there is still a significant issue: most (all?) links on the home page seems to point to the ZIM content (they are relative links) but when clicked the live online website is opened. Probably some Javascript is doing some nasty stuff. This has been observed in kiwix-serve, I did not tested other readers, probably doesn't make a difference.

@benoit74 benoit74 added the bug Something isn't working label Feb 9, 2024
@Jaifroid
Copy link

most (all?) links on the home page seems to point to the ZIM content (they are relative links) but when clicked the live online website is opened

Hmm, this "shouldn't" be possible since a sandbox was added to the Kiwix Serve iframe, unless it's been removed or you're opening the page directly outside of an iframe... Maybe you could make a small, 5-6 page ZIM including home page for testing?

@benoit74
Copy link
Collaborator Author

You are right, I pushed the file to dev.library.kiwix.org (here: https://dev.library.kiwix.org/viewer#developer.mozilla.org_en_all_2024-02) and the bug is not present there.

The bug is only present when running locally. Locally I'm using Docker image of kiwix-tools 3.6.0. Is there any parameter which needs to be set to activate the sandbox?

@Jaifroid
Copy link

The sandbox is in the viewer iframe on Kiwix Serve, I believe, though it's also possible to set it via CSP headers server side.

@Jaifroid
Copy link

Another issue with this ZIM: a number of articles (which I've verified to be in the ZIM) get redirected nearly instantly to a custom Mozilla 404 page. If you're quick, you can just see a flash of the original content before it gets redirected.

Here's an example:

Go to this page:

https://dev.library.kiwix.org/viewer#developer.mozilla.org_en_all_2024-02/developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web

and click on "JavaScript Basics" in the left-hand menu. If you're quick, you'll see the page loads, but then very quickly redirects to a custom Mozilla 404 page.

This doesn't happen in the Zimit1 version of the same page here:

https://library.kiwix.org/viewer#developer.mozilla.org_en_all_2024-01/A/developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web

NB I can see the content of such pages has been cached, and is all there and correct. The DevTools Cache API page even shows a graphical view of the loaded page (see screenshot). The redirect definitely happens after DOMContentReady as a result of a dynamic Fetch request (possibly one of the many POST requests). In the zimit1 version there are several Header lookups, and also some attempt to do fuzzy matching in the Service Worker after the content has loaded.

image

@mgautierfr
Copy link
Contributor

The fix is kiwix/libkiwix#1036 (confirm with @benoit74)

https://dev.library.org is nightly (and so, contains the fix), docker is release and doesn't have the fix.

@Jaifroid
Copy link

The redirect issue I mentioned above is occurring on dev.library.org, therefore it must be something else (I thought it was related to the problem of determining the final location of a ZIM URL, hence related to this issue). I'll make it into a separate issue, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants