Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	src/services/sync_table.js
This commit is contained in:
zadam 2020-03-14 12:58:47 +01:00
commit 08606f7d88
2 changed files with 7 additions and 7 deletions

View file

@ -235,8 +235,6 @@ async function importEnex(taskContext, file, parentNote) {
taskContext.increaseProgressCount(); taskContext.increaseProgressCount();
let noteContent = await noteEntity.getContent();
for (const resource of resources) { for (const resource of resources) {
const hash = utils.md5(resource.content); const hash = utils.md5(resource.content);
@ -268,7 +266,7 @@ async function importEnex(taskContext, file, parentNote) {
const resourceLink = `<a href="#root/${resourceNote.noteId}">${utils.escapeHtml(resource.title)}</a>`; const resourceLink = `<a href="#root/${resourceNote.noteId}">${utils.escapeHtml(resource.title)}</a>`;
noteContent = noteContent.replace(mediaRegex, resourceLink); content = content.replace(mediaRegex, resourceLink);
}; };
if (["image/jpeg", "image/png", "image/gif", "image/webp"].includes(resource.mime)) { if (["image/jpeg", "image/png", "image/gif", "image/webp"].includes(resource.mime)) {
@ -281,12 +279,12 @@ async function importEnex(taskContext, file, parentNote) {
const imageLink = `<img src="${url}">`; const imageLink = `<img src="${url}">`;
noteContent = noteContent.replace(mediaRegex, imageLink); content = content.replace(mediaRegex, imageLink);
if (!noteContent.includes(imageLink)) { if (!content.includes(imageLink)) {
// if there wasn't any match for the reference, we'll add the image anyway // if there wasn't any match for the reference, we'll add the image anyway
// otherwise image would be removed since no note would include it // otherwise image would be removed since no note would include it
noteContent += imageLink; content += imageLink;
} }
} catch (e) { } catch (e) {
log.error("error when saving image from ENEX file: " + e); log.error("error when saving image from ENEX file: " + e);
@ -298,7 +296,7 @@ async function importEnex(taskContext, file, parentNote) {
} }
// save updated content with links to files/images // save updated content with links to files/images
await noteEntity.setContent(noteContent); await noteEntity.setContent(content);
await noteService.scanForLinks(noteEntity.noteId); await noteService.scanForLinks(noteEntity.noteId);

View file

@ -211,6 +211,8 @@ async function transactional(func) {
transactionActive = false; transactionActive = false;
resolve(); resolve();
setTimeout(() => require('./ws').sendPingToAllClients(), 50);
} }
catch (e) { catch (e) {
if (transactionActive) { if (transactionActive) {