1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

All: Fixes #2091: Handle WebDAV servers that do not return a last modified date (fixes mail.ru)

This commit is contained in:
Laurent Cozic 2019-12-18 10:46:12 +00:00
parent ff94a95589
commit 74fd9e1e9e
3 changed files with 15 additions and 1 deletions

View File

@ -195,6 +195,8 @@ class WebDavApi {
}
if (outputType === 'string') {
if (!output) throw new JoplinError(`String property not found: ${propName}: ${JSON.stringify(resource)}`, 'stringNotFound');
// If the XML has not attribute the value is directly a string
// If the XML node has attributes, the value is under "_".
// Eg for this XML, the string will be under {"_":"Thu, 01 Feb 2018 17:24:05 GMT"}:

View File

@ -55,6 +55,8 @@ shared.checkSyncConfigMessages = function(comp) {
};
shared.checkNextcloudApp = async function(comp, settings) {
if (settings['sync.target'] !== 5) return;
comp.setState({ checkNextcloudAppResult: 'checking' });
let result = null;
const appApi = await reg.syncTargetNextcloud().appApi();

View File

@ -58,7 +58,17 @@ class FileApiDriverWebDav {
}
}
const lastModifiedString = this.api().resourcePropByName(resource, 'string', 'd:getlastmodified');
let lastModifiedString = null;
try {
lastModifiedString = this.api().resourcePropByName(resource, 'string', 'd:getlastmodified');
} catch (error) {
if (error.code === 'stringNotFound') {
// OK - the logic to handle this is below
} else {
throw error;
}
}
// Note: Not all WebDAV servers return a getlastmodified date (eg. Seafile, which doesn't return the
// property for folders) so we can only throw an error if it's a file.