Merge pull request #221 from mattermost/files-patch
Patch for issue with old uploaded files.
Этот коммит содержится в:
@@ -115,7 +115,7 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fileUrl := c.GetSiteURL() + "/api/v1/files/get/" + channelId + "/" + c.Session.UserId + "/" + uid + "/" + url.QueryEscape(files[i].Filename)
|
fileUrl := "/" + channelId + "/" + c.Session.UserId + "/" + uid + "/" + url.QueryEscape(files[i].Filename)
|
||||||
resStruct.Filenames = append(resStruct.Filenames, fileUrl)
|
resStruct.Filenames = append(resStruct.Filenames, fileUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
var type = utils.getFileType(fileInfo.ext);
|
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 = window.location.origin + "/api/v1/files/get" + fileInfo.path;
|
||||||
|
|
||||||
if (type === "image") {
|
if (type === "image") {
|
||||||
$('<img/>').attr('src', fileInfo.path+'_thumb.jpg').load(function(path, name){ return function() {
|
$('<img/>').attr('src', fileInfo.path+'_thumb.jpg').load(function(path, name){ return function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
@@ -102,6 +108,12 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
var type = utils.getFileType(fileInfo.ext);
|
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 = window.location.origin + "/api/v1/files/get" + fileInfo.path;
|
||||||
|
|
||||||
if (type === "image") {
|
if (type === "image") {
|
||||||
if (i < Constants.MAX_DISPLAY_FILES) {
|
if (i < Constants.MAX_DISPLAY_FILES) {
|
||||||
postFiles.push(
|
postFiles.push(
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user