mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
Desktop,Mobile,Cli: Fixes #10608: WebDAV synchronisation not working because of URL encoding differences (#11076)
This commit is contained in:
parent
85c2eb43dd
commit
e3576683b0
@ -953,6 +953,7 @@ packages/lib/eventManager.js
|
|||||||
packages/lib/file-api-driver-joplinServer.js
|
packages/lib/file-api-driver-joplinServer.js
|
||||||
packages/lib/file-api-driver-local.js
|
packages/lib/file-api-driver-local.js
|
||||||
packages/lib/file-api-driver-memory.js
|
packages/lib/file-api-driver-memory.js
|
||||||
|
packages/lib/file-api-driver-webdav.test.js
|
||||||
packages/lib/file-api-driver.test.js
|
packages/lib/file-api-driver.test.js
|
||||||
packages/lib/file-api.test.js
|
packages/lib/file-api.test.js
|
||||||
packages/lib/file-api.js
|
packages/lib/file-api.js
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -930,6 +930,7 @@ packages/lib/eventManager.js
|
|||||||
packages/lib/file-api-driver-joplinServer.js
|
packages/lib/file-api-driver-joplinServer.js
|
||||||
packages/lib/file-api-driver-local.js
|
packages/lib/file-api-driver-local.js
|
||||||
packages/lib/file-api-driver-memory.js
|
packages/lib/file-api-driver-memory.js
|
||||||
|
packages/lib/file-api-driver-webdav.test.js
|
||||||
packages/lib/file-api-driver.test.js
|
packages/lib/file-api-driver.test.js
|
||||||
packages/lib/file-api.test.js
|
packages/lib/file-api.test.js
|
||||||
packages/lib/file-api.js
|
packages/lib/file-api.js
|
||||||
|
@ -107,6 +107,8 @@ class FileApiDriverWebDav {
|
|||||||
output = href.substr(baseUrl.length);
|
output = href.substr(baseUrl.length);
|
||||||
} else if (href.indexOf(relativeBaseUrl) === 0) {
|
} else if (href.indexOf(relativeBaseUrl) === 0) {
|
||||||
output = href.substr(relativeBaseUrl.length);
|
output = href.substr(relativeBaseUrl.length);
|
||||||
|
} else if (decodeURIComponent(href).indexOf(decodeURIComponent(relativeBaseUrl)) === 0) {
|
||||||
|
output = decodeURIComponent(href).substring(decodeURIComponent(relativeBaseUrl).length);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`href ${href} not in baseUrl ${baseUrl} nor relativeBaseUrl ${relativeBaseUrl}`);
|
throw new Error(`href ${href} not in baseUrl ${baseUrl} nor relativeBaseUrl ${relativeBaseUrl}`);
|
||||||
}
|
}
|
||||||
|
29
packages/lib/file-api-driver-webdav.test.ts
Normal file
29
packages/lib/file-api-driver-webdav.test.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const { FileApiDriverWebDav } = require('./file-api-driver-webdav');
|
||||||
|
|
||||||
|
describe('file-api-driver-webdav', () => {
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
[
|
||||||
|
'/remote.php/dav/files/user@mail.com/Joplin/',
|
||||||
|
'/remote.php/dav/files/user%40mail.com/Joplin',
|
||||||
|
'',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'/remote.php/dav/files/user@mail.com/Joplin/.lock',
|
||||||
|
'/remote.php/dav/files/user%40mail.com/Joplin',
|
||||||
|
'.lock',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'/remote.php/dav/files/user@mail.com/joplin%20files/locks/',
|
||||||
|
'/remote.php/dav/files/user%40mail.com/joplin files',
|
||||||
|
'locks',
|
||||||
|
],
|
||||||
|
])('should return relative path even if encoding is different', (async (href: string, relativePath: string, result: string) => {
|
||||||
|
const driver = new FileApiDriverWebDav();
|
||||||
|
|
||||||
|
const baseUrl = 'https://use07.thegood.cloud/remote.php/dav/files/user%40mail.com/Joplin';
|
||||||
|
|
||||||
|
expect(driver.hrefToRelativePath_(href, baseUrl, relativePath)).toBe(result);
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user