Skip to content
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

[Bug] Downloaded chapters with pageCount 0 not listed in OPDS feed and cause errors when accessed #1265

Open
zeedif opened this issue Feb 14, 2025 · 11 comments
Labels
bug Something isn't working

Comments

@zeedif
Copy link
Contributor

zeedif commented Feb 14, 2025

Device information

  • Suwayomi-Server version: v1.1.1-r1682
  • Server Operating System: debian-12 (docker)
  • Server Desktop Environment: N/A
  • Server JVM version: Bundled (from Docker image)
  • Client Operating System: Windows & Android
  • Client Web Browser: microsoft edge & google chrome

Steps to reproduce

  1. Download multiple manga at once using the "Download unread" option in the WebUI (observed with the TuMangaOnline extension).
  2. Some manga download correctly, but a few end up with all chapters having pageCount = 0.
  3. Check the OPDS feed for these affected manga.
  4. Remove ChapterTable.pageCount greater 0 filter from getMangaFeed.
  5. Attempt to access a chapter through an OPDS client.

Expected behavior

  1. Downloaded chapters should appear in OPDS feed
  2. Chapters should be accessible without errors

Actual behavior

  1. Chapters don't appear in OPDS due to pageCount=0 filter
  2. Removing filter leads to NoSuchElementException when accessing chapters

Context from Discord discussion:

  • pageCount isn't populated during download, only via API/GraphQL calls
  • Downloader should ideally populate pageCount
  • OPDS feed currently filters out chapters with pageCount=0 as safety measure
  • Removing filter exposes underlying issue of missing chapter data

Affected workflow:

  1. Chapters downloaded through WebUI have pageCount=0
  2. OPDS feed hides these chapters due to filter
  3. Manual filter removal leads to page access failures
  4. Server log shows empty collection error when accessing pages

This creates contradiction between:

  • Need to filter out invalid chapters (current pageCount>0 check)
  • Underlying data not being populated during normal download workflow
@zeedif zeedif added the bug Something isn't working label Feb 14, 2025
Copy link

@zeedif this issue was automatically closed because:

  • The acknowledgment section was not removed

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2025
@Syer10 Syer10 reopened this Feb 14, 2025
@schroda
Copy link
Collaborator

schroda commented Feb 14, 2025

the pageCount gets set at two places in the code

  1. ChapterForDownload#updatePageCount, which gets called

    • when calling the fetchChapterPages mutation
    • when downloading a chapter
  2. Chapter#fetchChapterList in case a fetched chapter already existed with a different url

the only way I see that a chapter gets marked as downloaded without having a valid pageCount is when a chapter without any pages gets downloaded

@zeedif
Copy link
Contributor Author

zeedif commented Feb 14, 2025

What I find curious is that it wasn't specific chapters; I downloaded about 11 series, and of those, two entire series have their chapters marked as downloaded, but none of them have a pageCount greater than 0. So, perhaps it's related to how updatePageCount is called when series are downloaded from Browse > Source > {my_favorite_source} > {manga_name} > Download > Unread or from Library > {manga name} > Download > Unread, since that's how I did those downloads.

@schroda
Copy link
Collaborator

schroda commented Feb 14, 2025

have you checked what the server logged for these chapter downloads?

So, perhaps it's related to how updatePageCount is called when series are downloaded from Browse > Source > {my_favorite_source} > {manga_name} > Download > Unread or from Library > {manga name} > Download > Unread, since that's how I did those downloads.

the clients have no impact on how the server handles the download, they just call the api and tell the server what should get downloaded

@zeedif
Copy link
Contributor Author

zeedif commented Feb 14, 2025

I just checked the logs to see what was happening, and those two specific series weren’t showing up in the logs. I went to check their folders and found they only had the comicinfo.xml files. So, I went to the WebUI, deleted them, and tried downloading one chapter again. When I saw the download finished instantly, I decided to remove them from my favorites, went to the Browse tab, navigated to my source, searched for the manga again, re-added it, and re-downloaded it. Now it seems to be downloading correctly. The only thing I can think of is that there might have been a broken reference between the source and the manga. I should also mention that I imported my reading progress and favorited manga using the backup file generated by TachiJ2K from the Backup menu > Create backup.

@schroda
Copy link
Collaborator

schroda commented Feb 15, 2025

sounds like

the only way I see that a chapter gets marked as downloaded without having a valid pageCount is when a chapter without any pages gets downloaded

was the problem with the chapters incorrectly getting marked as downloaded (fixed by #1268)

maybe the backup included outdated urls for the manga, but then I would expect the request for the chapters pages to fail instead of returning an empty list, but could also be that the source doesn't handles this properly?

@Syer10
Copy link
Collaborator

Syer10 commented Feb 15, 2025

The latest preview build includes the fix, so if it is determined to be that issue, then it shouldn't happen anymore.

@schroda
Copy link
Collaborator

schroda commented Feb 15, 2025

we probably should add a migration to fix chapters which are in such a state, just to be sure (forgot to add it in #1268)

@Syer10
Copy link
Collaborator

Syer10 commented Feb 15, 2025

If we click download and it detects a cbz, will it check if it has pages or not?

@schroda
Copy link
Collaborator

schroda commented Feb 15, 2025

it checks if the first page exists

@Syer10
Copy link
Collaborator

Syer10 commented Feb 15, 2025

@zeedif in the latest preview, any downloads with this issue will be marked as not download when you update to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants