From 3efc6fb05e5c89455498b679c4eb3c5786123968 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 17 Nov 2017 02:45:44 +0300 Subject: [PATCH] reworked filename handling... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/filesystem.js | 9 +++++---- ui (gen4)/imagegrid/images.js | 9 +++++---- ui (gen4)/imagegrid/ribbons.js | 1 - ui (gen4)/lib/util.js | 2 +- ui (gen4)/lib/widget/browse.js | 3 +-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index 1c50bd81..f8fa2e78 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -227,7 +227,8 @@ module.FileSystemInfo = core.ImageGridFeatures.Feature({ // NOTE: this will also manage .location.from var FileSystemLoaderActions = actions.Actions({ config: { - 'image-file-pattern': '*+(jpg|jpeg|png|svg|JPG|JPEG|PNG|svg)', + // XXX BUG: for some reason this does not match/see '.jpg' filename... + 'image-file-pattern': '*.@(jpg|jpeg|png|svg|JPG|JPEG|PNG|svg)', 'image-file-read-stat': true, 'image-file-skip-previews': false, @@ -2165,10 +2166,10 @@ var FileSystemWriterActions = actions.Actions({ var img_name = pathlib.basename(img.path || (img.name + img.ext)) // get best preview... - var from = decodeURI( - (img.base_path || base_dir) + var from = (img.base_path || base_dir) +'/' - + that.images.getBestPreview(gid, size).url) + + that.images.getBestPreview(gid, size).url + // XXX see if we need to make a preview (sharp) // XXX diff --git a/ui (gen4)/imagegrid/images.js b/ui (gen4)/imagegrid/images.js index 63a7c050..7bdcaa67 100755 --- a/ui (gen4)/imagegrid/images.js +++ b/ui (gen4)/imagegrid/images.js @@ -465,6 +465,9 @@ module.ImagesPrototype = { [img.base_path || path, img.path].join('/') : util.path2url(img.path) }, + // NOTE: actual URL decoding and encoding is not done here to keep + // things consistent, rather it is done the the latest possible + // stage, in images._loadImagePreviewURL(..) // XXX see: ribbons.js for details... // XXX this is the same (in part) as .getImagePath(..) getBestPreview: function(gid, size, img_data, full_path){ @@ -484,8 +487,7 @@ module.ImagesPrototype = { } var s - // XXX not sure about encodeURI(..) here... - var url = encodeURI(util.path2url(img_data.path)) + var url = img_data.path var preview_size = 'Original' var p = Infinity var previews = img_data.preview || {} @@ -499,9 +501,8 @@ module.ImagesPrototype = { } } return { - //url: normalizePath(url), url: (full_path && img_data.base_path ? - util.path2url(img_data.base_path) + '/' + img_data.base_path + '/' : '') + url, size: preview_size diff --git a/ui (gen4)/imagegrid/ribbons.js b/ui (gen4)/imagegrid/ribbons.js index 6ef1eb9c..cdfba758 100755 --- a/ui (gen4)/imagegrid/ribbons.js +++ b/ui (gen4)/imagegrid/ribbons.js @@ -1596,7 +1596,6 @@ var RibbonsPrototype = { if(old_gid != gid // the new preview (p_url) is different to current... // NOTE: this may not work correctly for relative urls... - //|| image.css('background-image').indexOf(encodeURI(p_url)) < 0){ || image.css('background-image').indexOf(util.path2url(p_url)) < 0){ // sync load... if(sync){ diff --git a/ui (gen4)/lib/util.js b/ui (gen4)/lib/util.js index 0bf88dcc..cb25da7f 100755 --- a/ui (gen4)/lib/util.js +++ b/ui (gen4)/lib/util.js @@ -201,7 +201,7 @@ function(path){ //.map(encodeURIComponent) .join('/') // NOTE: keep '%' the first... - //.replace(/%/g, '%25') + .replace(/%/g, '%25') .replace(/#/g, '%23') .replace(/&/g, '%26')) } diff --git a/ui (gen4)/lib/widget/browse.js b/ui (gen4)/lib/widget/browse.js index a5bc6f24..97d31da2 100755 --- a/ui (gen4)/lib/widget/browse.js +++ b/ui (gen4)/lib/widget/browse.js @@ -1777,11 +1777,10 @@ var BrowserPrototype = { // .menu() // -> this // - // Trigger menu event on pattern item... + // Select and trigger menu event on selected item... // .menu(pattern) // -> this // - // NOTE: pattern is .select(..) compatible pattern. menu: function(){ arguments[0] instanceof Function ? this.dom.on('menu', arguments[0])