summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-07-28 11:30:22 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-07-29 10:03:42 -0400
commitf66cd5e9773a38cca635d33d91f0ef3b056d94a0 (patch)
tree2582063489d5b6ded95ba47cb73043debaa1a895 /web/react/components
parent0e121a68de2d99ac17b27e41d92efae7721c6578 (diff)
downloadchat-f66cd5e9773a38cca635d33d91f0ef3b056d94a0.tar.gz
chat-f66cd5e9773a38cca635d33d91f0ef3b056d94a0.tar.bz2
chat-f66cd5e9773a38cca635d33d91f0ef3b056d94a0.zip
Added utility function to get a file attachment's url
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/file_attachment.jsx10
1 files changed, 1 insertions, 9 deletions
diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx
index fd5adb8b4..e730af5f2 100644
--- a/web/react/components/file_attachment.jsx
+++ b/web/react/components/file_attachment.jsx
@@ -71,16 +71,8 @@ module.exports = React.createClass({
var filename = filenames[this.props.index];
var fileInfo = utils.splitFileLocation(filename);
- if (Object.keys(fileInfo).length === 0) return null;
-
var type = utils.getFileType(fileInfo.ext);
- // This is a temporary patch to fix issue with old files using absolute paths
- if (fileInfo.path.indexOf("/api/v1/files/get") != -1) {
- fileInfo.path = fileInfo.path.split("/api/v1/files/get")[1];
- }
- fileInfo.path = utils.getWindowLocationOrigin() + "/api/v1/files/get" + fileInfo.path;
-
var thumbnail;
if (type === "image") {
thumbnail = <div ref={filename} className="post__load" style={{backgroundImage: 'url(/static/images/load.gif)'}}/>;
@@ -92,7 +84,7 @@ module.exports = React.createClass({
var self = this;
// asynchronously request the size of the file so that we can display it next to the thumbnail
- utils.getFileSize(fileInfo.path + "." + fileInfo.ext, function(fileSize) {
+ utils.getFileSize(utils.getFileUrl(filename), function(fileSize) {
self.setState({fileSize: fileSize});
});
}