diff options
Diffstat (limited to 'apps/files/js/fileinfomodel.js')
-rw-r--r-- | apps/files/js/fileinfomodel.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/files/js/fileinfomodel.js b/apps/files/js/fileinfomodel.js index ab205b2efb4..22b1ca9ff0c 100644 --- a/apps/files/js/fileinfomodel.js +++ b/apps/files/js/fileinfomodel.js @@ -31,16 +31,15 @@ */ var FileInfoModel = OC.Backbone.Model.extend({ + defaults: { + mimetype: 'application/octet-stream', + path: '' + }, + initialize: function(data) { if (!_.isUndefined(data.id)) { data.id = parseInt(data.id, 10); } - - // TODO: normalize path - data.path = data.path || ''; - data.name = data.name; - - data.mimetype = data.mimetype || 'application/octet-stream'; }, /** @@ -58,7 +57,7 @@ * @return {boolean} true if this is an image, false otherwise */ isImage: function() { - return this.get('mimetype')? this.get('mimetype').substr(0, 6) === 'image/' : false; + return this.has('mimetype') ? this.get('mimetype').substr(0, 6) === 'image/' : false; }, /** |