mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixing file uploads and previews for new /team/ URL structure
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user