From eec850c11f09538239d03de4a57f2858ff638143 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 20 Aug 2020 11:14:27 +0200 Subject: [PATCH 1/2] fix toggle sidebar issues, closes #1196 --- package-lock.json | 8 ++++---- package.json | 2 +- src/public/app/widgets/note_tree.js | 1 + src/public/app/widgets/side_pane_toggles.js | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 481284c32..fee9f588c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "trilium", - "version": "0.43.0-beta", + "version": "0.43.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -7923,9 +7923,9 @@ "integrity": "sha512-0L9FvHG3nfnnmaEQPjT9xhfN4ISk0A8/2j4M37Np4mcDesJjHgEUfgPhdCyZuFI954tjokaIj/A3NdpFNdEh4Q==" }, "node-abi": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.16.0.tgz", - "integrity": "sha512-+sa0XNlWDA6T+bDLmkCUYn6W5k5W6BPRL6mqzSCs6H/xUgtl4D5x2fORKDzopKiU6wsyn/+wXlRXwXeSp+mtoA==", + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.18.0.tgz", + "integrity": "sha512-yi05ZoiuNNEbyT/xXfSySZE+yVnQW6fxPZuFbLyS1s6b5Kw3HzV2PHOM4XR+nsjzkHxByK+2Wg+yCQbe35l8dw==", "requires": { "semver": "^5.4.1" }, diff --git a/package.json b/package.json index 4633d521f..22f2a5270 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "jimp": "0.10.3", "mime-types": "2.1.27", "multer": "1.4.2", - "node-abi": "2.16.0", + "node-abi": "2.18.0", "open": "7.0.3", "portscanner": "2.2.0", "rand-token": "1.0.1", diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 5d78a6904..a5802acb5 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 df443ae13..fbb5a055c 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 = ` } - - + + From a89629b3de8df2925365d761f73031a132ce618e Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 20 Aug 2020 11:34:14 +0200 Subject: [PATCH 2/2] add fallback when resizing image fails, closes #1190 --- src/services/image.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/services/image.js b/src/services/image.js index 9d5d5fa50..3a525ce45 100644 --- a/src/services/image.js +++ b/src/services/image.js @@ -98,7 +98,17 @@ async function saveImage(parentNoteId, uploadBuffer, originalName, shrinkImageSw async function shrinkImage(buffer, originalName) { // we do resizing with max (100) quality which will be trimmed during optimization step next - const resizedImage = await resize(buffer, 100); + let resizedImage; + + try { + resizedImage = await resize(buffer, 100); + } + catch (e) { + log.error("Failed to resize image '" + originalName + "'\nStack: " + e.stack); + + resizedImage = buffer; + } + let finalImageBuffer; const jpegQuality = await optionService.getOptionInt('imageJpegQuality'); @@ -107,7 +117,15 @@ async function shrinkImage(buffer, originalName) { finalImageBuffer = await optimize(resizedImage, jpegQuality); } catch (e) { log.error("Failed to optimize image '" + originalName + "'\nStack: " + e.stack); - finalImageBuffer = await resize(buffer, jpegQuality); + + try { + finalImageBuffer = await resize(buffer, jpegQuality); + } + catch (e) { + log.error("Failed to resize image '" + originalName + "'\nStack: " + e.stack); + + finalImageBuffer = buffer; + } } // if resizing & shrinking did not help with size then save the original