diff options
author | Corey Hulen <corey@hulen.com> | 2015-07-21 13:00:35 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-07-21 13:00:35 -0800 |
commit | 384223a3e7fe6350e6087849fcc1f75923cc80c9 (patch) | |
tree | 3217cf6a99db6e07a7d5b90142033f05e8e70ea7 /web | |
parent | 1de50f0e4fd8b6a36e29af66375f9db592ce5774 (diff) | |
parent | 1c08a33b92f72d77d6c5f1fce916e2cd7c655ff0 (diff) | |
download | chat-384223a3e7fe6350e6087849fcc1f75923cc80c9.tar.gz chat-384223a3e7fe6350e6087849fcc1f75923cc80c9.tar.bz2 chat-384223a3e7fe6350e6087849fcc1f75923cc80c9.zip |
Merge pull request #223 from mattermost/files-patch
Fixing file uploads and previews for new /team/ URL structure
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/file_preview.jsx | 1 | ||||
-rw-r--r-- | web/react/components/post_body.jsx | 4 | ||||
-rw-r--r-- | web/react/components/view_image.jsx | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/web/react/components/file_preview.jsx b/web/react/components/file_preview.jsx index 17a1e2bc2..553293d2b 100644 --- a/web/react/components/file_preview.jsx +++ b/web/react/components/file_preview.jsx @@ -19,6 +19,7 @@ module.exports = React.createClass({ var filenameSplit = filename.split('.'); var ext = filenameSplit[filenameSplit.length-1]; var type = utils.getFileType(ext); + filename = window.location.origin + "/api/v1/files/get" + filename; if (type === "image") { previews.push( diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index 96b441c0e..7871f52b7 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -29,7 +29,7 @@ module.exports = React.createClass({ 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) { + if (fileInfo.path.indexOf("/api/v1/files/get") != -1) { fileInfo.path = fileInfo.path.split("/api/v1/files/get")[1]; } fileInfo.path = window.location.origin + "/api/v1/files/get" + fileInfo.path; @@ -109,7 +109,7 @@ module.exports = React.createClass({ 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) { + if (fileInfo.path.indexOf("/api/v1/files/get") != -1) { fileInfo.path = fileInfo.path.split("/api/v1/files/get")[1]; } fileInfo.path = window.location.origin + "/api/v1/files/get" + fileInfo.path; diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx index 2274f3f2e..4675269d5 100644 --- a/web/react/components/view_image.jsx +++ b/web/react/components/view_image.jsx @@ -36,6 +36,11 @@ module.exports = React.createClass({ src = this.props.filenames[id]; } else { var fileInfo = utils.splitFileLocation(this.props.filenames[id]); + // 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 = window.location.origin + "/api/v1/files/get" + fileInfo.path; src = fileInfo['path'] + '_preview.jpg'; } |