From d58398708ee4c47ba403bc56ee5b14fc0941f797 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 21 Jul 2015 23:34:20 -0400 Subject: fixed download link in image viewer --- web/react/components/view_image.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx index ac0ecf299..c107de4d7 100644 --- a/web/react/components/view_image.jsx +++ b/web/react/components/view_image.jsx @@ -37,7 +37,7 @@ module.exports = React.createClass({ } 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) { + 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; @@ -145,7 +145,7 @@ module.exports = React.createClass({ preview_filename = this.props.filenames[this.state.imgId]; } else { // This is a temporary patch to fix issue with old files using absolute paths - if (info.path.indexOf("/api/v1/files/get") != -1) { + if (info.path.indexOf("/api/v1/files/get") !== -1) { info.path = info.path.split("/api/v1/files/get")[1]; } info.path = window.location.origin + "/api/v1/files/get" + info.path; @@ -161,6 +161,13 @@ module.exports = React.createClass({ var imgFragment = React.addons.createFragment(img); + // This is a temporary patch to fix issue with old files using absolute paths + var download_link = this.props.filenames[this.state.imgId]; + if (download_link.indexOf("/api/v1/files/get") !== -1) { + download_link = download_link.split("/api/v1/files/get")[1]; + } + download_link = window.location.origin + "/api/v1/files/get" + download_link; + return ( {loading} -- cgit v1.2.3-1-g7c22