From 969c19b2e926331e2686208507c2643107caf5a1 Mon Sep 17 00:00:00 2001 From: Michael Jobst Date: Mon, 21 Nov 2016 15:03:45 +0100 Subject: Fixed size issues on main detail view and disappearing of share recipients (#26603) * fixed size issues on main detail view and disappearing of share recipients * Changes due to code comments * Moved reloadProperties() to FileInfoModel * Solved Scrutinizer issues * Bugfix: undefined value used on error * check if options are set for FileInfoModel.initialize() Signed-off-by: Arthur Schiwon --- core/js/files/client.js | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'core/js/files') diff --git a/core/js/files/client.js b/core/js/files/client.js index 87559b2084c..cde3afde9d7 100644 --- a/core/js/files/client.js +++ b/core/js/files/client.js @@ -31,9 +31,9 @@ this._root = this._root.substr(0, this._root.length - 1); } - var url = 'http://'; + var url = Client.PROTOCOL_HTTP + '://'; if (options.useHTTPS) { - url = 'https://'; + url = Client.PROTOCOL_HTTPS + '://'; } url += options.host + this._root; @@ -64,6 +64,19 @@ Client.NS_OWNCLOUD = 'http://owncloud.org/ns'; Client.NS_NEXTCLOUD = 'http://nextcloud.org/ns'; Client.NS_DAV = 'DAV:'; + + Client.PROPERTY_GETLASTMODIFIED = '{' + Client.NS_DAV + '}getlastmodified'; + Client.PROPERTY_GETETAG = '{' + Client.NS_DAV + '}getetag'; + Client.PROPERTY_GETCONTENTTYPE = '{' + Client.NS_DAV + '}getcontenttype'; + Client.PROPERTY_RESOURCETYPE = '{' + Client.NS_DAV + '}resourcetype'; + Client.PROPERTY_INTERNAL_FILEID = '{' + Client.NS_OWNCLOUD + '}fileid'; + Client.PROPERTY_PERMISSIONS = '{' + Client.NS_OWNCLOUD + '}permissions'; + Client.PROPERTY_SIZE = '{' + Client.NS_OWNCLOUD + '}size'; + Client.PROPERTY_GETCONTENTLENGTH = '{' + Client.NS_DAV + '}getcontentlength'; + + Client.PROTOCOL_HTTP = 'http'; + Client.PROTOCOL_HTTPS = 'https'; + Client._PROPFIND_PROPERTIES = [ /** * Modified time @@ -259,23 +272,23 @@ var props = response.propStat[0].properties; var data = { - id: props['{' + Client.NS_OWNCLOUD + '}fileid'], + id: props[Client.PROPERTY_INTERNAL_FILEID], path: OC.dirname(path) || '/', name: OC.basename(path), - mtime: (new Date(props['{' + Client.NS_DAV + '}getlastmodified'])).getTime() + mtime: (new Date(props[Client.PROPERTY_GETLASTMODIFIED])).getTime() }; - var etagProp = props['{' + Client.NS_DAV + '}getetag']; + var etagProp = props[Client.PROPERTY_GETETAG]; if (!_.isUndefined(etagProp)) { data.etag = this._parseEtag(etagProp); } - var sizeProp = props['{' + Client.NS_DAV + '}getcontentlength']; + var sizeProp = props[Client.PROPERTY_GETCONTENTLENGTH]; if (!_.isUndefined(sizeProp)) { data.size = parseInt(sizeProp, 10); } - sizeProp = props['{' + Client.NS_OWNCLOUD + '}size']; + sizeProp = props[Client.PROPERTY_SIZE]; if (!_.isUndefined(sizeProp)) { data.size = parseInt(sizeProp, 10); } @@ -294,12 +307,12 @@ data.isFavorite = false; } - var contentType = props['{' + Client.NS_DAV + '}getcontenttype']; + var contentType = props[Client.PROPERTY_GETCONTENTTYPE]; if (!_.isUndefined(contentType)) { data.mimetype = contentType; } - var resType = props['{' + Client.NS_DAV + '}resourcetype']; + var resType = props[Client.PROPERTY_RESOURCETYPE]; var isFile = true; if (!data.mimetype && resType) { var xmlvalue = resType[0]; @@ -310,7 +323,7 @@ } data.permissions = OC.PERMISSION_READ; - var permissionProp = props['{' + Client.NS_OWNCLOUD + '}permissions']; + var permissionProp = props[Client.PROPERTY_PERMISSIONS]; if (!_.isUndefined(permissionProp)) { var permString = permissionProp || ''; data.mountType = null; @@ -752,7 +765,7 @@ }, /** - * Returns the password + * Returns the password * * @since 11.0.0 * @return {String} password @@ -816,4 +829,3 @@ OC.Files.Client = Client; })(OC, OC.Files.FileInfo); - -- cgit v1.2.3