laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.8k stars 4.97k forks source link

Sync not working with Seafile #1260

Closed deanishe closed 5 years ago

deanishe commented 5 years ago

Operating system

Application

I'm trying to sync via Seafile, but Joplin isn't uploading any notes, and I'm getting the following error in both the Mac and iOS clients:

Last error: Error: href /Joplin/ not in baseUrl https://example.com/seafdav/Joplin nor relativeBaseUrl /seafdav/Joplin

My WebDAV URL in the config is https://example.com/seafdav/Joplin

I have verified that it works correctly with other WebDAV clients.

Here's the debug log from the desktop client:

2019-02-25 18:31:39: "Sync: finished: Synchronisation finished [1551115875226]"
2019-02-25 18:31:39: "Reducer action", "SYNC_REPORT_UPDATE"
2019-02-25 18:31:39: "Operations completed: "
2019-02-25 18:31:39: "Total folders: 1"
2019-02-25 18:31:39: "Total notes: 5"
2019-02-25 18:31:39: "Total resources: 3"
2019-02-25 18:31:39: "There was some errors:"
2019-02-25 18:31:39: "Error: href /Joplin/ not in baseUrl https://example.com/seafdav/Joplin nor relativeBaseUrl /seafdav/Joplin
Error: href /Joplin/ not in baseUrl https://example.com/seafdav/Joplin nor relativeBaseUrl /seafdav/Joplin
    at FileApiDriverWebDav.hrefToRelativePath_ (/Applications/Joplin.app/Contents/Resources/app/lib/file-api-driver-webdav.js:101:10)
    at FileApiDriverWebDav.statsFromResources_ (/Applications/Joplin.app/Contents/Resources/app/lib/file-api-driver-webdav.js:114:22)
    at FileApiDriverWebDav.list (/Applications/Joplin.app/Contents/Resources/app/lib/file-api-driver-webdav.js:279:22)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)"
2019-02-25 18:31:39: "Reducer action", "SYNC_COMPLETED"
2019-02-25 18:31:39: "Setting up recurrent sync with interval 300"

The directories .sync/ and .resource/ are created, but are empty. No notes are uploaded.

Here's what I'm getting in the webserver logs:

XXX.XXX.XXX.XXX - - [25/Feb/2019:17:31:10 +0000] "PROPFIND /seafdav/Joplin/ HTTP/1.1" 207 414 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
XXX.XXX.XXX.XXX - - [25/Feb/2019:17:31:15 +0000] "MKCOL /seafdav/Joplin/.sync/ HTTP/1.1" 405 457 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
XXX.XXX.XXX.XXX - - [25/Feb/2019:17:31:16 +0000] "MKCOL /seafdav/Joplin/.resource/ HTTP/1.1" 405 457 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
XXX.XXX.XXX.XXX - - [25/Feb/2019:17:31:16 +0000] "PROPFIND /seafdav/Joplin/ HTTP/1.1" 207 1076 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
XXX.XXX.XXX.XXX - - [25/Feb/2019:17:31:21 +0000] "PROPFIND /seafdav/Joplin/ HTTP/1.1" 207 1076 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
XXX.XXX.XXX.XXX - - [25/Feb/2019:17:31:28 +0000] "PROPFIND /seafdav/Joplin/ HTTP/1.1" 207 1076 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
XXX.XXX.XXX.XXX - - [25/Feb/2019:17:31:39 +0000] "PROPFIND /seafdav/Joplin/ HTTP/1.1" 207 1076 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"

Here's the (prettified) response from running curl -i --basic --user 'myuser@example.com' -X PROPFIND https://example.com/seafdav/Joplin/.sync --upload-file - -H "Depth: 1" <<end

Clearly, this is where the dud path is coming from.

HTTP/2 207
content-security-policy: default-src 'self'
content-type: application/xml
date: Mon, 25 Feb 2019 17:49:10 GMT
referrer-policy: no-referrer
strict-transport-security: max-age=2592000;
x-clacks-overhead: GNU Terry Pratchett
x-content-type-options: nosniff
x-frame-options: DENY
x-xss-protection: 1; mode=block;
content-length: 706

<?xml version='1.0' encoding='UTF-8'?>
<ns0:multistatus xmlns:ns0="DAV:">
    <ns0:response>
        <ns0:href>/Joplin/.sync/</ns0:href>
        <ns0:propstat>
            <ns0:prop>
                <ns0:resourcetype>
                    <ns0:collection/>
                </ns0:resourcetype>
                <ns0:displayname>.sync</ns0:displayname>
                <ns0:getetag>0000000000000000000000000000000000000000</ns0:getetag>
                <ns0:lockdiscovery/>
                <ns0:supportedlock>
                    <ns0:lockentry>
                        <ns0:lockscope>
                            <ns0:exclusive/>
                        </ns0:lockscope>
                        <ns0:locktype>
                            <ns0:write/>
                        </ns0:locktype>
                    </ns0:lockentry>
                    <ns0:lockentry>
                        <ns0:lockscope>
                            <ns0:shared/>
                        </ns0:lockscope>
                        <ns0:locktype>
                            <ns0:write/>
                        </ns0:locktype>
                    </ns0:lockentry>
                </ns0:supportedlock>
            </ns0:prop>
            <ns0:status>HTTP/1.1 200 OK</ns0:status>
        </ns0:propstat>
    </ns0:response>
</ns0:multistatus>

Any ideas?

deanishe commented 5 years ago

Never mind. Figured it out after faffing around with my Caddyfile.

For anyone else having issues with Seafile's WebDAV and Caddy, this seems to work:

Caddyfile:

example.com/seafdav {
     proxy / localhost:8080/seafdav {
         without /seafdav
         transparent
     }
     ...
}

seafdav.conf:

[WEBDAV]
enabled = true
port = 8080
fastcgi = false
share_name = /seafdav