mickstar / Zoo-For-Zotero

This is an Android app for viewing Zotero libraries.
577 stars 53 forks source link

Cannot push annotations (ItemChangedSinceException) #159

Open Djoop opened 2 years ago

Djoop commented 2 years ago

Hi, I'm just starting to use Zoo for Zotero, thanks for the app! However, I have some trouble with synchronization (I use webdav sync on a self-hosted server): I modified a document and uploaded annotations, and it worked. Now I modified it again on the device (without modifying remotely), and when I try to send modifications, the app asks me if I really want to sync because my local version is out of date (which is weird because I didn't do any modifications remotely), and even if I say that I'm sure to be willing to do the sync, it fails with "Error uploading attachment / com.mickstarify.zooforzotero.ZoteroAPI.ItemChangedSinceException: Local item out of date, please sync first". I will try to see if it happens for all documents or not, but do you have any explanation for this?

markNZed commented 2 years ago

I'm trying to use a similar setup (self-hosted webdav). It seems Zoo for Zotero is downloading the attachments from webdav into the Downloads folder on my Android device and I can open the PDF attachment from Zoo for Zotero in the PDF reader. When I add annotations (and save the PDF) I do not get any notification in Zoo for Zotero to upload the attachment and it is not uploaded to webdav. @Djoop do you know where Zoo for Zotero is storing the attachments on your system? Is there a way to for Zoo for Zoero to upload an attachment to WebDav? Thanks.

I've found that that a long tap on the attachment can open a menu with "open", "Force Re-upload" and "Delete local copy". The force re-upload leads to an error error "uploading attachment javaj.io.InterruptedIOException: timeout zoo for zotero" and here is a closed issue mentioning this https://github.com/mickstar/Zoo-For-Zotero/issues/97

I'm trying to use a very small text file instead of a PDF. This is leading to the same error reported above "Local item out of date, please sync first" I sync the in Zoo for Zotero and it asks again if I want to upload, I confirm, then get a simialr message that the local copy is older and it asks "are you sure you upload" I tap "I AM SURE". It gives the same error "Localitem out of date, please sync first." There is also a popup that briefly appears saying the upload succedded and it has actaully uploaded.

Perhaps there is an issue with PDF but I wonder if the timeout is too short for the poor internet connection I'm using.

Djoop commented 2 years ago

By default attachments go to Downloads, but you can choose a custom path via the settings. It might be that you need to use a custom path to give the app the rights to track the changes made to the files? I have no idea but it's worth trying to see if it makes a difference. Just to add details to my first message:

markNZed commented 2 years ago

If it is a timeout issue then soon this might fix it: https://github.com/mickstar/Zoo-For-Zotero/issues/161#issuecomment-1037219494

I wonder if you could see if the upload duration is playing a role e.g. try with a very large document.

mickstar commented 2 years ago

Apologies, it's likely just some synchronisation bug. I wrote the WebDAV code almost 2 years ago while I was still learning web programming.

The whole file syncing stack is need of review. I hope to get to it eventually.