Removed temporary fix for old filenames that used absolute urls pointing to the get file api

Этот коммит содержится в:
hmhealey
2016-01-06 09:54:05 -05:00
родитель 239d147d97
Коммит a6ba1a17fe
3 изменённых файлов: 3 добавлений и 26 удалений

Просмотреть файл

@@ -533,13 +533,7 @@ export function getPreviewImagePath(filename) {
const fileType = getFileType(fileInfo.ext);
if (fileType === 'image') {
// 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 = getWindowLocationOrigin() + '/api/v1/files/get' + fileInfo.path;
return fileInfo.path + '_preview.jpg?' + getSessionIndex();
return getFileUrl(fileInfo.path + '_preview.jpg');
}
// 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.
export function getFileUrl(filename) {
var url = filename;
// 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;
return getWindowLocationOrigin() + '/api/v1/files/get' + filename + '?' + getSessionIndex();
}
// Gets the name of a file (including extension) from a given url or file path.