mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
Return fileNotFound error when file cannot be opened so that it is skipped by synchroniser
This commit is contained in:
parent
29f6e74ee3
commit
6789b98ead
@ -7,6 +7,7 @@ const { mime } = require('lib/mime-utils.js');
|
||||
const { filename } = require('lib/path-utils.js');
|
||||
const { FsDriverDummy } = require('lib/fs-driver-dummy.js');
|
||||
const { markdownUtils } = require('lib/markdown-utils.js');
|
||||
const JoplinError = require('lib/JoplinError');
|
||||
|
||||
class Resource extends BaseItem {
|
||||
|
||||
@ -35,7 +36,7 @@ class Resource extends BaseItem {
|
||||
|
||||
static async serialize(item, type = null, shownKeys = null) {
|
||||
let fieldNames = this.fieldNames();
|
||||
fieldNames.push('type_');
|
||||
fieldNames.push('type_');
|
||||
//fieldNames = ArrayUtils.removeElement(fieldNames, 'encryption_blob_encrypted');
|
||||
return super.serialize(item, 'resource', fieldNames);
|
||||
}
|
||||
@ -92,7 +93,13 @@ class Resource extends BaseItem {
|
||||
|
||||
const encryptedPath = this.fullPath(resource, true);
|
||||
if (resource.encryption_blob_encrypted) return { path: encryptedPath, resource: resource };
|
||||
await this.encryptionService().encryptFile(plainTextPath, encryptedPath);
|
||||
|
||||
try {
|
||||
await this.encryptionService().encryptFile(plainTextPath, encryptedPath);
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') throw new JoplinError('File not found:' + error.toString(), 'fileNotFound');
|
||||
throw error;
|
||||
}
|
||||
|
||||
const resourceCopy = Object.assign({}, resource);
|
||||
resourceCopy.encryption_blob_encrypted = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user