diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index ae2cf1da1..a4494e53c 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -32,6 +32,7 @@ const TPL = ` .tree { height: 100%; overflow: auto; + padding-bottom: 20px; } .refresh-search-button { diff --git a/src/public/app/widgets/side_pane_toggles.js b/src/public/app/widgets/side_pane_toggles.js index dc4db7714..0b04dd40a 100644 --- a/src/public/app/widgets/side_pane_toggles.js +++ b/src/public/app/widgets/side_pane_toggles.js @@ -20,8 +20,8 @@ const TPL = ` } - - + + diff --git a/src/services/image.js b/src/services/image.js index b1894c6d2..9420245e3 100644 --- a/src/services/image.js +++ b/src/services/image.js @@ -20,7 +20,7 @@ async function processImage(uploadBuffer, originalName, shrinkImageSwitch) { shrinkImageSwitch = false; } - const finalImageBuffer = shrinkImageSwitch ? await shrinkImage(uploadBuffer) : uploadBuffer; + const finalImageBuffer = shrinkImageSwitch ? await shrinkImage(uploadBuffer, originalName) : uploadBuffer; const imageFormat = getImageType(finalImageBuffer); @@ -104,11 +104,20 @@ function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSwitch) }; } -async function shrinkImage(buffer) { +async function shrinkImage(buffer, originalName) { const jpegQuality = optionService.getOptionInt('imageJpegQuality'); - let finalImageBuffer = await resize(buffer, jpegQuality); - // if resizing & shrinking did not help with size then save the original + let finalImageBuffer; + try { + finalImageBuffer = await resize(buffer, jpegQuality); + } + catch (e) { + log.error("Failed to resize image '" + originalName + "'\nStack: " + e.stack); + + finalImageBuffer = buffer; + } + + // if resizing did not help with size then save the original // (can happen when e.g. resizing PNG into JPEG) if (finalImageBuffer.byteLength >= buffer.byteLength) { finalImageBuffer = buffer;