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

Desktop,Mobile,Cli: Fixes #10608: WebDAV synchronisation not working because of URL encoding differences #11076

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

pedr
Copy link
Collaborator

@pedr pedr commented Sep 17, 2024

Fixes #10608

Summary

When using the WebDAV sync target the items data returned by the server doesn't encode URI elements of email (see test example at [email protected]), but it will encode URI folders with spaces (joplin files turns into joplin%20files).

When using the WebDAV sync target, synchronisation can fail because of the difference between the encodings of the data returned by the WebDAV API (in this case specific to the d:href property) and the relativeBaseUrl property.

Differences that I noticed:

  • d:href does not encode @ but relativeBaseUrl does
  • relativeBaseUrl does not encode whitespace while d:href does

I think the best solution for this would be to fix this encoding difference before it reaches the hrefToRelativePath_ function (where this PR is fixing the issue) but since it is near the feature freeze I thought that the simplesest solution would be better.

Testing

I added automated tests to the hrefToRelativePath_ function on file-api-driver-webdav.test.ts.

To create the tests I made some real world testing described bellow:

1 - Created a Joplin folder on my base WebDAV server
2 - Added WebDav as my sync target, my sync target URL has my [email protected] address on it
3 - Created some notebooks and notes and tried to synch
4 - Found the error reported in the issue because @ on email address is encoded to %40 on relativeBaseUrl value, but the d:href property with the relative path to the file doesn't encode it

Other test case:

1 - Created a joplin files folder on my base WebDAV server
2 - Added WebDav as my sync target, my sync target URL has my [email protected] address on it
3 - Created some notebooks and notes and tried to synch
4 - Now I found that d:href encodes whites spaces while relativeBaseUrl does not

@pedr pedr added bug It's a bug sync sync related issue labels Sep 17, 2024
@pedr pedr requested a review from laurent22 September 17, 2024 22:04
@laurent22 laurent22 merged commit e357668 into laurent22:dev Sep 23, 2024
10 checks passed
@laurent22
Copy link
Owner

Looks good, thanks Pedro

@pedr pedr deleted the fix-webdav-encoding-problem branch September 24, 2024 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug sync sync related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement workaround for WebDAV encoding issue on certain servers
2 participants