kiwix / web

Bugs, enhancements, ideas for our Web presence
https://kiwix.org
7 stars 6 forks source link

Incorrect formatting of magnet links provided by download.kiwix.org #155

Open Jaifroid opened 2 years ago

Jaifroid commented 2 years ago

As you can see from https://download.kiwix.org/zim/zimit/courses.lumenlearning.com_en_all_2021-03.zim.magnet (just an example), the magnet links provided by download.kiwix.org contain ampersands that have been converted to the HTML entity format &.

image

However, these links are explicitly served as text/plain (see screenshot below), not as text/html, and they are in any case meant to be strings that clients can use, so they should not be coded with HTML entity references.

The practical consequence of this is that, for example, in qBittorrent, the magnet link stalls at first because the tracker information provided in the link is not recognized. It is listed as "tracker-less" by qBittorrent. It takes a while for discovery to find the file as a result, and it remains stalled for quite a while.

If, however, I simply substitute all & with & in the string, then qBittorrent can parse it correctly, and download of the file starts immediately.

In my implementation in KJSW, I am having to do a replace on the string in my code in order to present a correct URL to the user. However, this replacement should really be done at source IMHO.

image

kelson42 commented 2 years ago

Looks like a bug in Mirrorbrain

kelson42 commented 2 years ago

@Juz00 We should probably workaround that bug in libkiwix!

kelson42 commented 2 years ago

The upstream bug is https://github.com/poeml/mirrorbrain/issues/51

rgaudin commented 11 months ago

Fix in libkiwix about to be merged https://github.com/kiwix/libkiwix/pull/1001