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

Webdav sync error on plaintext response #241

Closed
bartlibert opened this Issue Feb 19, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@bartlibert
Copy link

bartlibert commented Feb 19, 2018

Operating system

  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Application

  • Desktop
  • Mobile
  • Terminal

I have set up webdav syncing, but this always fails with a "Cannot parse JSON respose" error. The application does show "Completed", but no notes where synced.
As I use the terminal, I also installed the GUI and tried "Check sync config". This reports "OK", but the syncing also fails there.
I tried the MKCOL command by hand using curl and I see that it returns a plaintext "Created" and a 201 return code. I guess Joplin expects a response in xml and/or json format? If I look in the Webdav RFC, it seems a plaintext response to MKCOL is OK?

Some system info:

  • Debian buster/sid
  • Node v9.5.0
  • curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.0.2n zlib/1.2.8 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) libssh2/1.8.0 nghttp2/1.30.0 librtmp/2.3
  • joplin 1.0.98 (prod)

UPDATE: I also have the same error (Cannot parse JSON response) in the Android app.
UPDATE2: If I mount the webdav in Linux (via gvfs) and use sync to file, everything works fine, so the problem is most likely not related to the webdav server.

2018-02-19 09:19:02: "Shortcut:", ":", "{"keys":[":"],"type":"function","command":"enter_command_line_mode","canRunAlongOtherCommands":false}"
2018-02-19 09:19:05: "Got command: sync"
2018-02-19 09:19:05: "execCommand()", "["sync"]"
2018-02-19 09:19:05: "Reducer action", "SYNC_STARTED"
2018-02-19 09:19:05: "Sync: starting: Starting synchronisation to target 6... [1519028345365]"
2018-02-19 09:19:05: "Reducer action", "SYNC_REPORT_UPDATE"
2018-02-19 09:19:05: "mkdir .sync"
2018-02-19 09:19:09: "Preparing scheduled sync"
2018-02-19 09:19:09: "Starting scheduled sync"
2018-02-19 09:19:09: "Synchronisation is already in progress. State: in_progress"
2018-02-19 09:19:09: "Setting up recurrent sync with interval 300"
2018-02-19 09:19:26: "Error: Cannot parse JSON response: Created
Code: 201
Error: Cannot parse JSON response: Created
at loadResponseJson (/home/bart/.virtualenvs/joplin/lib/node_modules/joplin/lib/WebDavApi.js:271:30)
at
at process._tickCallback (internal/process/next_tick.js:160:7)"
2018-02-19 09:19:26: "Sync: finished: Synchronisation finished [1519028345365]"
2018-02-19 09:19:26: "Reducer action", "SYNC_REPORT_UPDATE"
2018-02-19 09:19:26: "Operations completed: "
2018-02-19 09:19:26: "Total folders: 3"
2018-02-19 09:19:26: "Total notes: 35"
2018-02-19 09:19:26: "Total resources: 5"
2018-02-19 09:19:26: "There was some errors:"
2018-02-19 09:19:26: "Error: Cannot parse JSON response: Created
Code: 201
Error: Cannot parse JSON response: Created
at loadResponseJson (/home/bart/.virtualenvs/joplin/lib/node_modules/joplin/lib/WebDavApi.js:271:30)
at
at process._tickCallback (internal/process/next_tick.js:160:7)"
2018-02-19 09:19:26: "Reducer action", "SYNC_COMPLETED"
2018-02-19 09:19:26: "Reducer action", "FOLDER_SELECT, 5a6d5cba64074ec5aca630868a9cf965"
2018-02-19 09:19:26: "Refreshing notes:", "2", "5a6d5cba64074ec5aca630868a9cf965"
2018-02-19 09:19:26: "Reducer action", "NOTE_UPDATE_ALL, "{"options":{"order":[{"by":"user_updated_time","dir":"DESC"}],"uncompletedTodosOnTop":true},"parentId":"5a6d5cba64074ec5aca630868a9cf965"}""
2018-02-19 09:19:26: "Reducer action", "NOTE_SELECT, 899fe8c7c7734bc4a06421388ff20185"

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Feb 19, 2018

Yes there's a sanity check at the end which checks that the response is indeed valid XML, but I see I shouldn't do that if it can potentially be plain text (the message about JSON is because the XML is converted to JSON). I will remove this check and it should work.

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Feb 19, 2018

By the way, which WebDAV service is it?

@laurent22 laurent22 closed this in c70ecb3 Feb 19, 2018

@bartlibert

This comment has been minimized.

Copy link

bartlibert commented Feb 20, 2018

It works now, thanks for the fast fix!
The WebDAV service is http://stackstorage.com, an invite-only service by Dutch hosting company transip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment