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
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

View File

@ -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

View File

@ -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){

View File

@ -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'))
}

View File

@ -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])