foobnix / LibreraReader

Book Reader for Android
http://librera.mobi
Other
2.72k stars 297 forks source link

Caching issue with epubs that are opened, deleted, added on to on the OPDS server and redownloaded #1199

Closed Nitrousoxide closed 7 months ago

Nitrousoxide commented 7 months ago

I've noticed an issue with the table of contents on redownloaded books that have additional chapters added since the last version was opened. The reader correctly renders the additional pages but does not populate the ToC with the updated chapters.

Steps to replicate

Generate an epub using fanficfare for a story on Royal Road. Open and read the epub, generating the cache for the file. Delete the epub when done New chapters are added so run fanficfare again to update the epub. Download new epub with the same name. Book is rendered but table of contents does not list new chapter.

Opening the file with another eBook reader properly displays the whole chapter list.

Some examples images from a file. Librera Reader Last chapter displayed in ToC Screenshot_20231201-142942

Later chapters render Screenshot_20231201-142956

Moonreader correctly displays the additional chapter. Screenshot_20231201-143018

I don't know what is going on exactly, but I suspect it is using the ToC cache for the previous version of the file for the new altered one. If that is it you may want to run a hash of the file and compare it to the cache before using it to ensure that a file with the same name doesn't have altered content from the previous version.

Nitrousoxide commented 7 months ago

Manually clearing the app cache in android does make it regenerate the ToC, so I do suspect it is a caching issue. Screenshot_20231201-143946 Screenshot_20231201-144000

nobkd commented 7 months ago

Yes, can you try changing your font size? It sounds totally similar to this: https://github.com/foobnix/LibreraReader/issues/1197#issuecomment-1834539196 It is just a temporary fix, but probably allows purging the ToC cache

Nitrousoxide commented 7 months ago

Can do. I'll have to wait for another update for a book to get published so I can check to see if that fixes it, since it seemed to happen to every updates file. I'll report back if it fixed it or not in a few says when one come through.

foobnix commented 7 months ago

fixed in new beta.librera.mobi

Nitrousoxide commented 7 months ago

Actually, lucky me, a new chapter just released for another story I follow. Changing the text size did reflow the text but did not regenerate the ToC. The chapter notice at the bottom was also reporting the wrong chapter that it was in too. Screenshot_20231201-150649 Screenshot_20231201-150658

Nitrousoxide commented 7 months ago

Just tested the beta as I had another story add a chapter. While I wasn't able to replicate the exact steps I did with the google play version since the beta version does not have OPDS support, I did first download the previous version of the file using a separate OPDS browser, opened the file, deleted it, updated the file on my server, then manually downloaded the (updated) file again using my OPDS browser and Librera Reader did correctly rebuild the table of contents.

So that seems like it's fixed in the beta assuming there isn't something I did in my slightly changed procedure that worked around it, though I doubt that.