Removed temporary fix for old filenames that used absolute urls pointing to the get file api
Этот коммит содержится в:
@@ -125,10 +125,6 @@ export default class FileAttachment extends React.Component {
|
|||||||
getFileInfoFromName(name) {
|
getFileInfoFromName(name) {
|
||||||
var fileInfo = utils.splitFileLocation(name);
|
var fileInfo = utils.splitFileLocation(name);
|
||||||
|
|
||||||
// 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;
|
fileInfo.path = utils.getWindowLocationOrigin() + '/api/v1/files/get' + fileInfo.path;
|
||||||
|
|
||||||
return fileInfo;
|
return fileInfo;
|
||||||
|
|||||||
@@ -35,12 +35,7 @@ export default class FilePreview extends React.Component {
|
|||||||
var ext = filenameSplit[filenameSplit.length - 1];
|
var ext = filenameSplit[filenameSplit.length - 1];
|
||||||
var type = Utils.getFileType(ext);
|
var type = Utils.getFileType(ext);
|
||||||
|
|
||||||
// This is a temporary patch to fix issue with old files using absolute paths
|
filename = Utils.getFileUrl(filename);
|
||||||
|
|
||||||
if (filename.indexOf('/api/v1/files/get') !== -1) {
|
|
||||||
filename = filename.split('/api/v1/files/get')[1];
|
|
||||||
}
|
|
||||||
filename = Utils.getWindowLocationOrigin() + '/api/v1/files/get' + filename + '?' + Utils.getSessionIndex();
|
|
||||||
|
|
||||||
if (type === 'image') {
|
if (type === 'image') {
|
||||||
previews.push(
|
previews.push(
|
||||||
|
|||||||
@@ -533,13 +533,7 @@ export function getPreviewImagePath(filename) {
|
|||||||
const fileType = getFileType(fileInfo.ext);
|
const fileType = getFileType(fileInfo.ext);
|
||||||
|
|
||||||
if (fileType === 'image') {
|
if (fileType === 'image') {
|
||||||
// This is a temporary patch to fix issue with old files using absolute paths
|
return getFileUrl(fileInfo.path + '_preview.jpg');
|
||||||
if (fileInfo.path.indexOf('/api/v1/files/get') !== -1) {
|
|
||||||
fileInfo.path = fileInfo.path.split('/api/v1/files/get')[1];
|
|
||||||
}
|
|
||||||
fileInfo.path = getWindowLocationOrigin() + '/api/v1/files/get' + fileInfo.path;
|
|
||||||
|
|
||||||
return fileInfo.path + '_preview.jpg?' + getSessionIndex();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// only images have proper previews, so just use a placeholder icon for non-images
|
// only images have proper previews, so just use a placeholder icon for non-images
|
||||||
@@ -1069,15 +1063,7 @@ export function fileSizeToString(bytes) {
|
|||||||
|
|
||||||
// Converts a filename (like those attached to Post objects) to a url that can be used to retrieve attachments from the server.
|
// Converts a filename (like those attached to Post objects) to a url that can be used to retrieve attachments from the server.
|
||||||
export function getFileUrl(filename) {
|
export function getFileUrl(filename) {
|
||||||
var url = filename;
|
return getWindowLocationOrigin() + '/api/v1/files/get' + filename + '?' + getSessionIndex();
|
||||||
|
|
||||||
// This is a temporary patch to fix issue with old files using absolute paths
|
|
||||||
if (url.indexOf('/api/v1/files/get') !== -1) {
|
|
||||||
url = filename.split('/api/v1/files/get')[1];
|
|
||||||
}
|
|
||||||
url = getWindowLocationOrigin() + '/api/v1/files/get' + url + '?' + getSessionIndex();
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the name of a file (including extension) from a given url or file path.
|
// Gets the name of a file (including extension) from a given url or file path.
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user