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

Wallabag: request errors occasionally result in deletion of all articles #8949

Closed
hrdl-github opened this issue Mar 25, 2022 · 3 comments · Fixed by #8950
Closed

Wallabag: request errors occasionally result in deletion of all articles #8949

hrdl-github opened this issue Mar 25, 2022 · 3 comments · Fixed by #8950
Milestone

Comments

@hrdl-github
Copy link
Contributor

  • KOReader version: 2022.03
  • Device: Kobo forma

Issue

Occasionally synchronisation of my wallabag client causes all my articles to be deleted. I managed to reproduce this with logging enabled. My web server provides an oauth token when requested, but does not see the second request (presumably because of network issues).

Steps to reproduce

crash.log (if applicable)
crash.log
03/25/22-21:41:41 DEBUG Wallabag: URL      https://CENSORED/oauth/v2/token
03/25/22-21:41:41 DEBUG Wallabag: method   POST
03/25/22-21:41:44 DEBUG Wallabag: URL      https://CENSORED/api/entries.json?archive=0&page=1&perPage=500
03/25/22-21:41:44 DEBUG Wallabag: method   GET
03/25/22-21:42:04 DEBUG Wallabag: Server error:  host or service not provided, or not known
03/25/22-21:42:04 DEBUG Wallabag: couldn't get page # 1
03/25/22-21:42:04 DEBUG Wallabag: number of articles:  0
03/25/22-21:42:04 DEBUG Wallabag: articles IDs from server:  {}
03/25/22-21:42:04 DEBUG Wallabag: Deleting local file (deleted on server):  /mnt/onboard/wallabag//[w-id_538] CENSORED.epub
03/25/22-21:42:04 DEBUG Wallabag: Deleting local file (deleted on server):  /mnt/onboard/wallabag//[w-id_536] CENSORED.epub
03/25/22-21:42:04 DEBUG Wallabag: Deleting local file (deleted on server):  /mnt/onboard/wallabag//[w-id_535] CENSORED.epub
03/25/22-21:42:04 DEBUG Wallabag: Deleting local file (deleted on server):  /mnt/onboard/wallabag//[w-id_534] CENSORED.epub
@hrdl-github
Copy link
Contributor Author

local articles_json = self:callAPI("GET", articles_url, nil, "", "", true)
if not articles_json then
-- we may have hit the last page, there are no more articles
logger.dbg("Wallabag: couldn't get page #", page)
break -- exit while loop
end
treats this just as like a zero-entry reply. How would you go about this? The simplest approach would probably be to abort as soon as any of the requests fails, returning false to the caller. Error checking is already implemented there, but the empty table evaluates to true here:
local articles = self:getArticleList()
if articles then

@Frenzie
Copy link
Member

Frenzie commented Mar 25, 2022

How would you go about this?

Based on your snippets above, something like:

local articles_json, err = self:callAPI("GET", articles_url, nil, "", "", true) 

if not articles_json and err == "server error" then
    return
end

@hrdl-github
Copy link
Contributor Author

Thanks, I will give it another go in a few days (well before 2022.04).

hrdl-github pushed a commit to hrdl-github/koreader that referenced this issue Mar 31, 2022
Frenzie pushed a commit that referenced this issue Apr 15, 2022
@Frenzie Frenzie added this to the 2022.04 milestone Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants