From be6ab4dfcad33ebf04151dbe5075dcfbc0d0fe2f Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 28 Feb 2021 04:16:55 +0300 Subject: [PATCH] bugfix... Signed-off-by: Alex A. Naanou --- Viewer/features/core.js | 3 +++ Viewer/features/examples.js | 3 +++ Viewer/features/sharp.js | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Viewer/features/core.js b/Viewer/features/core.js index a40ed0a7..46386852 100755 --- a/Viewer/features/core.js +++ b/Viewer/features/core.js @@ -2703,6 +2703,9 @@ function(title, func){ // thus making the final behaviour unpredictable. // // +// NOTE: promise results are .flat()-tened, thus if it is needed to return +// a list of arrays then one must wrap the handler return value in an +// array... // NOTE: sync-mode actions do not externally log anything, basic progress // logging is handled by the queue/task which is not created in sync // mode. diff --git a/Viewer/features/examples.js b/Viewer/features/examples.js index 4d782e95..b9ef1c79 100755 --- a/Viewer/features/examples.js +++ b/Viewer/features/examples.js @@ -375,6 +375,9 @@ var ExampleActions = actions.Actions({ console.log('\t\tSKIP', item) return runner.SKIP } + // NOTE: the handler's return value list is .flat()-end + // so if one needs to return a array the it must be + // wrapped in an array... return item+1 }), // handle inputs (async/queue)... function(item, ...args){ diff --git a/Viewer/features/sharp.js b/Viewer/features/sharp.js index 23219e10..a9d2df3d 100755 --- a/Viewer/features/sharp.js +++ b/Viewer/features/sharp.js @@ -288,7 +288,7 @@ var SharpActions = actions.Actions({ if(!image || !['image', null, undefined] .includes(image.type)){ return runner.SKIP } - return [ + return [[ // source... this.getImagePath(gid), // target... @@ -307,7 +307,7 @@ var SharpActions = actions.Actions({ flipped: image.flipped, // crop... }, - ] }), + ]] }), // do the actual resizing (global queue)... function([source, to, image={}], size, _, options={}){ // handle skipped items -- source, to and image are undefined... @@ -625,7 +625,7 @@ var SharpActions = actions.Actions({ var base = base_path || img.base_path || this.location.path - return [ + return [[ gid, // source... this.getImagePath(gid), @@ -643,7 +643,7 @@ var SharpActions = actions.Actions({ pathlib.join(base, name)), ] }), index_dir, - ]}), + ]]}), // generate the previews... // NOTE: this is competely isolated... // XXX args/logger is wrong here...