image import/export related fixes

This commit is contained in:
zadam
2019-07-10 23:01:30 +02:00
parent c3e1126489
commit 9de2927304
4 changed files with 8 additions and 9 deletions

View File

@@ -1,9 +1,9 @@
"use strict";
const imageType = require('image-type');
const imageService = require('../../services/image');
const utils = require('../../services/utils');
const dateNoteService = require('../../services/date_notes');
const sql = require('../../services/sql');
const noteService = require('../../services/notes');
const passwordEncryptionService = require('../../services/password_encryption');
const optionService = require('../../services/options');
@@ -36,9 +36,11 @@ async function uploadImage(req) {
return [400, "Unknown image type: " + file.mimetype];
}
const originalName = "Sender image." + imageType(file.buffer).ext;
const parentNote = await dateNoteService.getDateNote(req.headers['x-local-date']);
const {noteId} = await imageService.saveImage(file.buffer, "Sender image", parentNote.noteId, true);
const {noteId} = await imageService.saveImage(file.buffer, originalName, parentNote.noteId, true);
return {
noteId: noteId