reworked filename handling...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-11-17 02:45:44 +03:00
parent 71c4259746
commit 3efc6fb05e
5 changed files with 12 additions and 12 deletions

View File

@ -227,7 +227,8 @@ module.FileSystemInfo = core.ImageGridFeatures.Feature({
// NOTE: this will also manage .location.from // NOTE: this will also manage .location.from
var FileSystemLoaderActions = actions.Actions({ var FileSystemLoaderActions = actions.Actions({
config: { 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-read-stat': true,
'image-file-skip-previews': false, 'image-file-skip-previews': false,
@ -2165,10 +2166,10 @@ var FileSystemWriterActions = actions.Actions({
var img_name = pathlib.basename(img.path || (img.name + img.ext)) var img_name = pathlib.basename(img.path || (img.name + img.ext))
// get best preview... // get best preview...
var from = decodeURI( var from = (img.base_path || base_dir)
(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 see if we need to make a preview (sharp)
// XXX // XXX

View File

@ -465,6 +465,9 @@ module.ImagesPrototype = {
[img.base_path || path, img.path].join('/') [img.base_path || path, img.path].join('/')
: util.path2url(img.path) : 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 see: ribbons.js for details...
// XXX this is the same (in part) as .getImagePath(..) // XXX this is the same (in part) as .getImagePath(..)
getBestPreview: function(gid, size, img_data, full_path){ getBestPreview: function(gid, size, img_data, full_path){
@ -484,8 +487,7 @@ module.ImagesPrototype = {
} }
var s var s
// XXX not sure about encodeURI(..) here... var url = img_data.path
var url = encodeURI(util.path2url(img_data.path))
var preview_size = 'Original' var preview_size = 'Original'
var p = Infinity var p = Infinity
var previews = img_data.preview || {} var previews = img_data.preview || {}
@ -499,9 +501,8 @@ module.ImagesPrototype = {
} }
} }
return { return {
//url: normalizePath(url),
url: (full_path && img_data.base_path ? url: (full_path && img_data.base_path ?
util.path2url(img_data.base_path) + '/' img_data.base_path + '/'
: '') : '')
+ url, + url,
size: preview_size size: preview_size

View File

@ -1596,7 +1596,6 @@ var RibbonsPrototype = {
if(old_gid != gid if(old_gid != gid
// the new preview (p_url) is different to current... // the new preview (p_url) is different to current...
// NOTE: this may not work correctly for relative urls... // 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){ || image.css('background-image').indexOf(util.path2url(p_url)) < 0){
// sync load... // sync load...
if(sync){ if(sync){

View File

@ -201,7 +201,7 @@ function(path){
//.map(encodeURIComponent) //.map(encodeURIComponent)
.join('/') .join('/')
// NOTE: keep '%' the first... // NOTE: keep '%' the first...
//.replace(/%/g, '%25') .replace(/%/g, '%25')
.replace(/#/g, '%23') .replace(/#/g, '%23')
.replace(/&/g, '%26')) .replace(/&/g, '%26'))
} }

View File

@ -1777,11 +1777,10 @@ var BrowserPrototype = {
// .menu() // .menu()
// -> this // -> this
// //
// Trigger menu event on pattern item... // Select and trigger menu event on selected item...
// .menu(pattern) // .menu(pattern)
// -> this // -> this
// //
// NOTE: pattern is .select(..) compatible pattern.
menu: function(){ menu: function(){
arguments[0] instanceof Function ? arguments[0] instanceof Function ?
this.dom.on('menu', arguments[0]) this.dom.on('menu', arguments[0])