1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

All: Fixes #3955: Fixed sync issue when importing ENEX files that contain new line characters in the source URL attribute

This commit is contained in:
Laurent Cozic
2020-10-28 17:21:23 +00:00
parent 98c933fdb7
commit b52f6eb77c
3 changed files with 20 additions and 8 deletions

View File

@ -256,9 +256,11 @@ class BaseItem extends BaseModel {
propValue = JSON.stringify(propValue);
} else if (propValue === null || propValue === undefined) {
propValue = '';
} else {
propValue = `${propValue}`;
}
return propValue;
return propValue.replace(/\n/g, '\\n').replace(/\r/g, '\\r');
}
static unserialize_format(type, propName, propValue) {
@ -279,7 +281,7 @@ class BaseItem extends BaseModel {
propValue = Database.formatValue(ItemClass.fieldType(propName), propValue);
}
return propValue;
return typeof propValue === 'string' ? propValue.replace(/\\n/g, '\n').replace(/\\r/g, '\r') : propValue;
}
static async serialize(item, shownKeys = null) {