-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Redirection error in latest (2022-09) ifixit zim (English and Russian version) #826
Comments
@kelson42 this might be a kiwix-serve issue. The ZIM entries look correct: # this is OK. that's that's what it always looks like
zim.main_entry.is_redirect
> True
zim.main_entry.get_redirect_entry()
> Entry(url=Main-Page, title=Main-Page)
# here we see that we redirect from Main-Page to home/home. Again, that's normal. We do it everywhere
zim.main_entry.get_redirect_entry().is_redirect
> True
zim.main_entry.get_redirect_entry().get_redirect_entry()
> Entry(url=home/home, title=iFixit: The Free Repair Manual) Problem revolves around the handling of curl -I http://192.168.5.80:9999/ifixit_en_all_2022-09/
HTTP/1.1 302 Found
Connection: close
Content-Length: 0
Location: /ifixit_en_all_2022-09/
Access-Control-Allow-Origin: *
Cache-Control: no-cache, no-store, must-revalidate
Date: Mon, 03 Oct 2022 09:55:23 GMT
Accessing the curl -I http://192.168.5.80:9999/ifixit_en_all_2022-09/home/home
HTTP/1.1 200 OK
Connection: close
Content-Length: 21948
Content-Type: text/html
Access-Control-Allow-Origin: *
ETag: "1664790915539257/c"
Cache-Control: max-age=2723040, public
Date: Mon, 03 Oct 2022 09:57:59 GMT
Kiwix-JS is not affected by this bug, nor is kiwix-desktop macOS (97) |
Both were created using |
This is weird, I did not released any change in the scraper since previous |
@veloman-yunkan I have migrated the ticket from the iFixit repo (but the comments are not in the right order). This is a blocker for |
Confirming that the
ZIM entries are similar: zim.main_entry.is_redirect
> True
zim.main_entry.get_redirect_entry()
> Entry(url=Main-Page, title=Main-Page)
zim.main_entry.get_redirect_entry().is_redirect
> True
zim.main_entry.get_redirect_entry().get_redirect_entry()
> Entry(url=home/home, title=iFixit: The Free Repair Manual) Metadata are similar as well (not that it should matter)
|
The issue with ifixit_en_all_2022-09.zim is that it contains an item at the empty path "": $ zimdump list --url="" ifixit_en_all_2022-09.zim
path:
* title: Sales Policies
* idx: 0
* type: item
* mime-type: text/html
* item size: 4547 Currently in libkiwix/src/tools/archiveTools.cpp Lines 161 to 171 in f6ae75e
|
Ah! Very interesting ; I did not know that. Thanks. We'll fix the scraper. Leaving this open to discuss whether we still want that (weird?) behavior |
In any case, there is a bug in libkiwix/src/server/internalServer.cpp Lines 1045 to 1050 in f6ae75e
|
Before this fix the root URL for a book was assumed to resolve to the main page. This was not true for ZIM files containing an entry at an empty path or with a path equal to "/", resulting in issue #826. The logic behind this behaviour is found in `kiwix::getEntryFromPath()`. The fix to that issue is a little more general and will result in an HTTP redirect in any case where `kiwix::getEntryFromPath(zim, path)` returns an entry with a real path different from the requested one. In particular, this will affect the behaviour on ZIM files with the old namespace scheme, where the requested resource - if not found - is also looked up in the 'A', 'I', 'J', and/or '-' namespaces. Now instead of returning the contents of that other resource an HTTP redirect response will be sent.
I guess we can close this now. |
From ifixit created by laggykiller: openzim/ifixit#86
The latest (2022-09) ifixit zim (English and Russian version) has redirection error ('redirected you too many times')
The zim in question is here:
https://download.kiwix.org/zim/ifixit/ifixit_en_all_2022-09.zim
https://download.kiwix.org/zim/ifixit/ifixit_ru_all_2022-09.zim
You can test it out now from here:
https://library.kiwix.org/ifixit_en_all_2022-09
https://library.kiwix.org/ifixit_ru_all_2022-09
The previous versions (2022-06) are normal:
https://download.kiwix.org/zim/ifixit/ifixit_en_all_2022-06.zim
https://download.kiwix.org/zim/ifixit/ifixit_ru_all_2022-06.zim
Other languages are not affected
When viewed from kiwix-serve, it produces redirection error:
![image](https://user-images.githubusercontent.com/61652821/193469290-01733c32-9ed0-4a25-bb70-ccc441abf467.png)
When viewed from desktop application (e.g. Windows), the homepage is broken:
![image](https://user-images.githubusercontent.com/61652821/193469254-90fec9f7-fd3b-4991-91e5-4c11decfb8c7.png)
The text was updated successfully, but these errors were encountered: