From 64b179ab0e6a66c0f8edb72ab24ef28bbc2f9969 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 24 Aug 2015 15:03:52 -0700 Subject: Fixes mm-1912 move get file info into its own web service call --- web/react/components/file_attachment.jsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'web/react/components/file_attachment.jsx') diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx index c36c908d2..ab550d500 100644 --- a/web/react/components/file_attachment.jsx +++ b/web/react/components/file_attachment.jsx @@ -2,6 +2,7 @@ // See License.txt for license information. var utils = require('../utils/utils.jsx'); +var Client = require('../utils/client.jsx'); var Constants = require('../utils/constants.jsx'); module.exports = React.createClass({ @@ -103,12 +104,16 @@ module.exports = React.createClass({ if (this.state.fileSize < 0) { var self = this; - // asynchronously request the size of the file so that we can display it next to the thumbnail - utils.getFileSize(utils.getFileUrl(filename), function(fileSize) { - if (self.canSetState) { - self.setState({fileSize: fileSize}); + Client.getFileInfo( + filename, + function(data) { + if (self.canSetState) { + self.setState({fileSize: parseInt(data["size"], 10)}); + } + }, + function(err) { } - }); + ); } else { fileSizeString = utils.fileSizeToString(this.state.fileSize); } -- cgit v1.2.3-1-g7c22