X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/921131f99949960f448b2cfbb0ad78edc8d4f24a..5d42f36a2bf4db11f60ec9c24e4e30d493f6037f:/resources/js/wysiwyg/drop-paste-handling.js diff --git a/resources/js/wysiwyg/drop-paste-handling.js b/resources/js/wysiwyg/drop-paste-handling.js index 1da13c888..0529f6b6c 100644 --- a/resources/js/wysiwyg/drop-paste-handling.js +++ b/resources/js/wysiwyg/drop-paste-handling.js @@ -43,7 +43,6 @@ function paste(editor, options, event) { editor.dom.replace(newEl, id); }).catch(err => { editor.dom.remove(id); - // TODO - Check we have this translation window.$events.emit('error', options.translations.imageUploadErrorText); console.log(err); }); @@ -61,13 +60,7 @@ async function uploadImageFile(file, pageId) { throw new Error(`Not an image file`); } - let ext = 'png'; - if (file.name) { - let fileNameMatches = file.name.match(/\.(.+)$/); - if (fileNameMatches.length > 1) ext = fileNameMatches[1]; - } - - const remoteFilename = "image-" + Date.now() + "." + ext; + const remoteFilename = file.name || `image-${Date.now()}.png`; const formData = new FormData(); formData.append('file', file, remoteFilename); formData.append('uploaded_to', pageId);