diff --git a/apps/server/src/services/notes.ts b/apps/server/src/services/notes.ts index f06e07ed8..4c82c0e8c 100644 --- a/apps/server/src/services/notes.ts +++ b/apps/server/src/services/notes.ts @@ -76,7 +76,7 @@ function deriveMime(type: string, mime?: string) { function copyChildAttributes(parentNote: BNote, childNote: BNote) { for (const attr of parentNote.getAttributes()) { if (attr.name.startsWith("child:")) { - const name = attr.name.substr(6); + const name = attr.name.substring(6); const hasAlreadyTemplate = childNote.hasRelation("template"); if (hasAlreadyTemplate && attr.type === "relation" && name === "template") { @@ -472,7 +472,7 @@ async function downloadImage(noteId: string, imageUrl: string) { if (imageUrl.toLowerCase().startsWith("file://")) { imageBuffer = await new Promise((res, rej) => { - const localFilePath = imageUrl.substr("file://".length); + const localFilePath = imageUrl.substring("file://".length); return fs.readFile(localFilePath, (err, data) => { if (err) { @@ -521,14 +521,14 @@ function downloadImages(noteId: string, content: string) { const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url); if (inlineImageMatch) { - const imageBase64 = url.substr(inlineImageMatch[0].length); + const imageBase64 = url.substring(inlineImageMatch[0].length); const imageBuffer = Buffer.from(imageBase64, "base64"); const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, "inline image", true, true); const encodedTitle = encodeURIComponent(attachment.title); - content = `${content.substr(0, imageMatch.index)}${title}${content.substr(attachmentMatch.index + attachmentMatch[0].length)}`; + content = `${content.substring(0, attachmentMatch.index)}${title}${content.substring(attachmentMatch.index + attachmentMatch[0].length)}`; } // removing absolute references to server to keep it working between instances,