kiwix-android icon indicating copy to clipboard operation
kiwix-android copied to clipboard

Articles containing "?" cannot be opened

Open Inbefortus opened this issue 3 years ago • 26 comments

Kiwix Version: 3.4.4 ZIM: 2021-03 German and English Wikipedia

Articles that contain a "?" cannot be opened. You can only open them by opening them in a new tab, as demonstrated in the videos below:

https://user-images.githubusercontent.com/71934042/124366295-f58ab480-dc4e-11eb-93b7-cdb7edb5d0ea.mp4

https://user-images.githubusercontent.com/71934042/124366296-f6bbe180-dc4e-11eb-861b-1a7330a44a96.mp4

Inbefortus avatar Jul 03 '21 20:07 Inbefortus

Hello ! Can I fix it?

ibrahim1520 avatar Aug 08 '21 17:08 ibrahim1520

@ibrahim1520 Yes, but first, what is your analysis of the problem? How would look like your solution?

kelson42 avatar Aug 08 '21 17:08 kelson42

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Jan 03 '22 21:01 stale[bot]

Hi @kelson42 , I would like to work on this issue. However I'm a newbie here so could you guide me with this issue?

puranjayK avatar Jan 18 '22 19:01 puranjayK

@puranjayK OK, but what isnthe root cause? How do you plan to fix the problem?

kelson42 avatar Jan 18 '22 19:01 kelson42

@puranjayK OK, but what isnthe root cause? How do you plan to fix the problem?

@kelson42 I'm a newbie, so i don't have much idea what about this. Could u guide me where I need to start from and if I should even take this issue?

puranjayK avatar Jan 19 '22 07:01 puranjayK

@puranjayK This is not a programming lesson here. Either you have a clue how to fix it and you take it and if you have technical questions we might then help. But you need to know first what you have to do. All the necessary information should be available in the README.md to start with.

kelson42 avatar Jan 19 '22 07:01 kelson42

@kelson42 I might have come out wrong but I wasn't asking for progamming lessons. I meant I'm new to this org so can you help me from where I should begin for this issue?

puranjayK avatar Jan 19 '22 13:01 puranjayK

well I'd like to work on this issue might take 2-3 days cause i still need to look at the source code (downloaded it and got graddle working but its kinda late here for now and i got some classes)

also its funny (Varenyam Bhardwaj here)

airpods69 avatar Jan 23 '22 18:01 airpods69

image Seems like the "?" does something weird and messes up the URL for some reason well atleast this is what i could tell from the logs

airpods69 avatar Jan 23 '22 22:01 airpods69

also im so sorry @puranjayK I totally ignored the fact that you wanted to work on this issue!

airpods69 avatar Jan 23 '22 22:01 airpods69

image Seems like the "?" does something weird and messes up the URL for some reason well atleast this is what i could tell from the logs

@airpods69 could you tell me where you got the article which had this ?so that I can reproduce and see if I get something :)

cdhiraj40 avatar Jan 24 '22 08:01 cdhiraj40

image Seems like the "?" does something weird and messes up the URL for some reason well atleast this is what i could tell from the logs

@airpods69 could you tell me where you got the article which had this ?so that I can reproduce and see if I get something :)

found it in the wikipedia (the simplified english one i forgot the name ;-;) search for rihana then scroll down and look for the loud album open it and you should find the article with a "?" in it

airpods69 avatar Jan 24 '22 08:01 airpods69

Thanks @airpods69 telling me the file name. @kelson42 seems like the content doesn't exist in the kiwix library itself so it can't find it which results in not opening the next article for eg: http://library.kiwix.org/wikipedia_en_simple_all_maxi_2022-01/A/What's_My_Name? I don't think so if the issue is with our app

cdhiraj40 avatar Jan 24 '22 09:01 cdhiraj40

maybe it is an issue with link if you ask me (just a hunch tbh) image but looking at the links it doesnt allow or even consider "?" while looking for it

and also i used the simplified wikipedia because it had a smaller download size the person who opened the issue must have been using the complete version of wikipedia

airpods69 avatar Jan 24 '22 09:01 airpods69

maybe it is an issue with a link if you ask me, but looking at the links it doesn't allow or even consider "?" while looking for it

you are correct but I have noticed many times that the link with the ? mark in end doesn't matter it will go to the same link try: https://www.kiwix.org/en/support-us/code? https://www.primevideo.com? put the whole URL including ? in end, you will see it redirects to the same page.

and also I used the simplified Wikipedia because it had a smaller download size the person who opened the issue must have been using the complete version of Wikipedia

I checked in complete version only that is https://download.kiwix.org/zim/wikipedia/wikipedia_en_simple_all_maxi_2022-01.zim

cdhiraj40 avatar Jan 24 '22 09:01 cdhiraj40

well no thats not the issue here

"whats my name?" does exist instead of "?" it goes to %3F

so it doesnt exist cause its the wrong link which we are going to

replacing "?" with "%3F" should solve the issue while looking up for the link

we are looking for: http://library.kiwix.org/wikipedia_en_simple_all_maxi_2022-01/A/What's_My_Name?

when we should be looking for: http://library.kiwix.org/wikipedia_en_simple_all_maxi_2022-01/A/What's_My_Name%3F

so there you go the issue should be easy to solve just need to change how the link thingy works

airpods69 avatar Jan 24 '22 09:01 airpods69

well no thats not the issue here

"whats my name?" does exist instead of "?" it goes to %3F

so it doesnt exist cause its the wrong link which we are going to

replacing "?" with "%3F" should solve the issue while looking up for the link

we are looking for: http://library.kiwix.org/wikipedia_en_simple_all_maxi_2022-01/A/What's_My_Name?

when we should be looking for: http://library.kiwix.org/wikipedia_en_simple_all_maxi_2022-01/A/What's_My_Name%3F

okay yeah, that does solve the thing, I thought the link didn't exist. Thanks for the info ;)

so there you go the issue should be easy to solve just need to change how the link thingy works

I think it has to change from the library itself?

cdhiraj40 avatar Jan 24 '22 09:01 cdhiraj40

yep that seems to be the case for rihana but lemme just check with the german one

airpods69 avatar Jan 24 '22 09:01 airpods69

actually that doesnt explain one thing

if it doesnt redirect then why does it work when the link is opened in a new tab so that means its not a library issue right?

airpods69 avatar Jan 24 '22 09:01 airpods69

I am not sure how libraries work but replacing "?" with "%3F" at all occurrences when loading the URL should fix it without changing everything in the library

airpods69 avatar Jan 24 '22 09:01 airpods69

me and @cdhiraj40 discussed this but i thought putting it up here also would make sense so that everyone knows

IMG_20220124_153357~2.jpg

something interesting that i found

airpods69 avatar Jan 24 '22 14:01 airpods69

Hi all, this is an issue we also had in Kiwix JS. Please see https://github.com/kiwix/kiwix-js/issues/806 and the PR that fixes it https://github.com/kiwix/kiwix-js/pull/807. The issue is simply that the URL needs to have any querystrings and anchors removed BEFORE it is decoded.

A URL in a ZIM article is URI-encoded by default, but it may have additionally have a querystring, or an anchor (and that question mark and hash, if any, are not encoded). Usually a reader will have a function that removes any querysting and anchor before then decoding the URI and sending it to the backend for reading from the ZIM.

However, if the URI is decoded first and then querystrings are removed, then of course the question mark will be interpreted as a querystring and it and everything after will be removed.

You shouldn't substitute all question marks for %3F in the backend, or else you will introduce more problems than you solve! You should use a proper decodeURIComponent function after you have removed any querystring or hash anchor from the encoded URL in the article's HTML.

Jaifroid avatar Jan 26 '22 22:01 Jaifroid

org.kiwix.kiwixmobile.core.main.CoreWebViewClient in line 143 the url "https://kiwix.app/A/What's_My_Name?" is not encoded. So that would mean that the url is decoded somewhere else? I was not able to find the place where the actual request is done.

bip7686 avatar Mar 09 '22 17:03 bip7686

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Jun 12 '22 21:06 stale[bot]

@Inbefortus Maybe this bug is already fixed in 3.6.0, but otherwise we will fic it in 3.7.0.

kelson42 avatar Jul 28 '22 12:07 kelson42

@MohitMaliFtechiz Not a duplicate of #2847

kelson42 avatar Dec 01 '22 10:12 kelson42

@MohitMaliFtechiz Not a duplicate of #2847

hi @kelson42 , Both Issue are different. since #2847 is related to new tab(webview is not giving proper url to handle) and #2671 is for article contains ? not opening in same tab. but i have placed a fix for both issues in #2968.

MohitMaliFtechiz avatar Dec 01 '22 12:12 MohitMaliFtechiz

@kelson42, We already fixed this issue in https://github.com/kiwix/kiwix-android/pull/2968

MohitMaliFtechiz avatar Jul 10 '23 08:07 MohitMaliFtechiz

@Inbefortus I will close the ticket but woukd be glad to get your feedback to confirm this is fixed in 3.7.

kelson42 avatar Jul 10 '23 08:07 kelson42