kiwix / kiwix-android

Kiwix for Android
https://android.kiwix.org
GNU General Public License v3.0
878 stars 444 forks source link

Broken view of pages with "*.js" titles #2793

Closed fftmp closed 2 years ago

fftmp commented 2 years ago

Seems, raw HTML text is shown instead of rendered page.

As an example can check on small ZIM with page 'Node.js': https://download.kiwix.org/zim/other/archlinux_en_all_nopic_2022-03.zim For "big" wikipedia ZIM seems all other pages are broken also (backbone.js, ember.js, vue.js). These pages looks OK on linux version of kiwix.

Screenshots Kiwix_nodeJS

Environment

gouri-panda commented 2 years ago

@kelson42 Do you think it's Android related?

kelson42 commented 2 years ago

I think this is because the mime-type given by the zim for this page is not properly handled. This problem happened in the past and there was a ticket here. What is the mime-type here?

kelson42 commented 2 years ago

Sorry, i see the user uses an old version of Kiwix. @fftmp Please try with the most recent version.

gouri-panda commented 2 years ago

the user uses an old version of Kiwix

Is it the application or the zim file? The application version is relatively new.

kelson42 commented 2 years ago

Duplicate of #2174

fftmp commented 2 years ago

Sorry for using old version. This is the most recent version available from f-droid now. I tried version 3.4.5 Build: 6230405 and problem remains. I also can't see manually downloaded ZIM files anymore (may be related to #2787 ), so check against new ZIM from library.

@kelson42, can you reopen issue? Do you need more info?

BTW, also tried v3.4.4 - can see ZIM files, but have problem with .js pages.

kelson42 commented 2 years ago

@MohitMaliFtechiz Can you please have a look to that one as well?

MohitMaliFtechiz commented 2 years ago

ok @kelson42 ,

MohitMaliFtechiz commented 2 years ago

hi @kelson42 and @fftmp ,

I tried to open archwiki on version 3.4.4 and also current develop on three devices below and above android 10. Its rendering fine , I am unable to reproduce it . Please let me know if i am missing something. ?

fftmp commented 2 years ago

Just as ideas:

  1. Is it possible, that kiwix use some android component to render page and this component is differ on your Android and LineageOS?
  2. Is it possible, that rendered page was cached while I use old version and didn't renewed?

I check 3.4.5 on another device (with vendor preinstalled, but rooted Android 11 and custom browser) - bug reproduced. Still can't exclude previous ideas, because also try old apk from f-droid firstly.

I also try build and test current develop branch - 6b61cf02f6aaf151175aaf9ac21882f4e5973de4. Bug still reproduced. Using this version I can read previously downloaded ZIM. This is a bit strange, because #2787 is opened and correspondent branch is not merged to develop. Seems, that during installation this version asks for storage permission twice - firstly to photo/multimedia and then for permission for all files.

BTW, @kelson42, can you publish 3.4.6 release apk at github? As I can see tag already present in git.

kelson42 commented 2 years ago

@MohitMaliFtechiz I can reproduce the problem with Android11 on my google pixel2. Have you really tested with article "node.js"? I will verify if mimetype is correct in ZIM.

MohitMaliFtechiz commented 2 years ago

hi @kelson42 and @fftmp ,

I am able to replicate it , i was not opening node js page.

MohitMaliFtechiz commented 2 years ago

hi @kelson42 , @fftmp

I figured it out what's wrong with .js titles actually its case of mime mismatch , from server mime type we are getting is text/html even for .js type but on android if we fetch mime type of .js file is application/javascript. so this is can figured it out by two ways one is the correction from server end with correct mime type another on my end to code if conditions to avoid this situations.

By placing the conditions on my end solutions is working.

what is your thought on this ?

MohitMaliFtechiz commented 2 years ago

Hi ,

I have created the #issue2813 for this particular file since MIME type is return as text/html while must be application/javascript