1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
This commit is contained in:
Laurent Cozic 2018-02-21 19:20:33 +00:00
parent b9db747b5c
commit e1fd9c6922
4 changed files with 7 additions and 14 deletions

View File

@ -53,7 +53,7 @@ class SyncTargetWebDAV extends BaseSyncTarget {
try {
const result = await fileApi.stat('');
if (!result) throw new Error('Could not access WebDAV directory');
if (!result) throw new Error('WebDAV directory not found: ' + options.path);
output.ok = true;
} catch (error) {
output.errorMessage = error.message;

View File

@ -307,7 +307,7 @@ class WebDavApi {
if (json && json['d:error']) {
const code = json['d:error']['s:exception'] ? json['d:error']['s:exception'].join(' ') : response.status;
const message = json['d:error']['s:message'] ? json['d:error']['s:message'].join("\n") : 'Unknown error 1';
throw newError(message + '(Exception ' + code + ')', response.status);
throw newError(message + ' (Exception ' + code + ')', response.status);
}
throw newError('Unknown error 2', response.status);

View File

@ -27,7 +27,6 @@ class FileApiDriverWebDav {
const result = await this.api().execPropFind(path, 0, [
'd:getlastmodified',
'd:resourcetype',
// 'd:getcontentlength', // Remove this once PUT call issue is sorted out
]);
const resource = this.api().objectFromJson(result, ['d:multistatus', 'd:response', 0]);
@ -56,11 +55,7 @@ class FileApiDriverWebDav {
}
}
const lastModifiedString = this.api().resourcePropByName(resource, 'string', 'd:getlastmodified');
// const sizeDONOTUSE = Number(this.api().stringFromJson(resource, ['d:propstat', 0, 'd:prop', 0, 'd:getcontentlength', 0]));
// if (isNaN(sizeDONOTUSE)) throw new Error('Cannot get content size: ' + JSON.stringify(resource));
const lastModifiedString = this.api().resourcePropByName(resource, 'string', 'd:getlastmodified');
// 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.
@ -70,10 +65,8 @@ class FileApiDriverWebDav {
return {
path: path,
// created_time: lastModifiedDate.getTime(),
updated_time: lastModifiedDate.getTime(),
isDir: isDir,
// sizeDONOTUSE: sizeDONOTUSE, // This property is used only for the WebDAV PUT hack (see below) so mark it as such so that it can be removed with the hack later on.
};
}

View File

@ -58,10 +58,10 @@ reg.scheduleSync = async (delay = null) => {
reg.logger().info('Scheduling sync operation...');
// if (Setting.value('env') === 'dev') {
// reg.logger().info('Scheduling sync operation DISABLED!!!');
// return;
// }
if (Setting.value('env') === 'dev') {
reg.logger().info('Scheduling sync operation DISABLED!!!');
return;
}
const timeoutCallback = async () => {
reg.scheduleSyncId_ = null;