fixed an issue with metadata for empty image objects...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-06-29 20:28:38 +03:00
parent ef0ba18f75
commit a57dbc2d7e

View File

@ -378,6 +378,7 @@ var MetadataUIActions = actions.Actions({
// fields that expect that image data is available... // fields that expect that image data is available...
var info = ['---'] var info = ['---']
if(img){ if(img){
// some abstractions...
// XXX should these be here??? // XXX should these be here???
var _normalize = typeof(path) != 'undefined' ? var _normalize = typeof(path) != 'undefined' ?
path.normalize path.normalize
@ -387,28 +388,37 @@ var MetadataUIActions = actions.Actions({
: function(e){ return e.split(/[\\\/]/g).pop() } : function(e){ return e.split(/[\\\/]/g).pop() }
var _dirname = typeof(path) != 'undefined' ? var _dirname = typeof(path) != 'undefined' ?
function(e){ return path.normalize(path.dirname(e)) } function(e){ return path.normalize(path.dirname(e)) }
: function(e){ return _normalize(e.split(/[\\\/]/g).slice(0, -1).join('/')) } : function(e){
return _normalize(e.split(/[\\\/]/g).slice(0, -1).join('/')) }
base = base.concat([ // paths...
['File Name: ', img.path
_basename(img.path)], && base.push(['File Name: ',
['Parent Directory: ', _basename(img.path)])
_dirname((img.base_path || '.') +'/'+ img.path)], && base.push(['Parent Directory: ',
['Full Path: ', _dirname((img.base_path || '.') +'/'+ img.path)])
_normalize((img.base_path || '.') +'/'+ img.path)], && base.push(['Full Path: ',
_normalize((img.base_path || '.') +'/'+ img.path)])
['Date created: ', img.birthtime // times...
&& new Date(img.birthtime).toShortDate()], img.birthtime
['- ctime: ', img.ctime && new Date(img.ctime).toShortDate()], && base.push(['Date created: ',
['- mtime: ', img.mtime && new Date(img.mtime).toShortDate()], img.birthtime && new Date(img.birthtime).toShortDate()])
['- atime: ', img.atime && new Date(img.atime).toShortDate()], img.ctime
]) && base.push(['- ctime: ',
img.ctime && new Date(img.ctime).toShortDate()])
// comment and tags... img.mtime
info.push(['Comment: ', && base.push(['- mtime: ',
function(){ return img.comment || '' }]) img.mtime && new Date(img.mtime).toShortDate()])
img.atime
&& base.push(['- atime: ',
img.atime && new Date(img.atime).toShortDate()])
} }
// comment and tags...
info.push(['Comment: ',
function(){ return img && img.comment || '' }])
info.push(['Tags: ', info.push(['Tags: ',
function(){ return that.data.getTags().join(', ') || '' }]) function(){ return that.data.getTags().join(', ') || '' }])