fix: remove preview content-type override for aliyun oss compatibility
This commit is contained in:
@@ -686,30 +686,6 @@ function getBusyDownloadMessage() {
|
|||||||
return '当前网络繁忙,请稍后再试';
|
return '当前网络繁忙,请稍后再试';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPreviewContentTypeByPath(filePath = '') {
|
|
||||||
const ext = path.extname(String(filePath || '')).toLowerCase();
|
|
||||||
const map = {
|
|
||||||
'.jpg': 'image/jpeg',
|
|
||||||
'.jpeg': 'image/jpeg',
|
|
||||||
'.png': 'image/png',
|
|
||||||
'.gif': 'image/gif',
|
|
||||||
'.bmp': 'image/bmp',
|
|
||||||
'.webp': 'image/webp',
|
|
||||||
'.svg': 'image/svg+xml',
|
|
||||||
'.mp4': 'video/mp4',
|
|
||||||
'.mov': 'video/quicktime',
|
|
||||||
'.webm': 'video/webm',
|
|
||||||
'.mkv': 'video/x-matroska',
|
|
||||||
'.mp3': 'audio/mpeg',
|
|
||||||
'.wav': 'audio/wav',
|
|
||||||
'.flac': 'audio/flac',
|
|
||||||
'.ogg': 'audio/ogg',
|
|
||||||
'.m4a': 'audio/mp4',
|
|
||||||
'.aac': 'audio/aac'
|
|
||||||
};
|
|
||||||
return map[ext] || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseDateTimeValue(value) {
|
function parseDateTimeValue(value) {
|
||||||
if (!value || typeof value !== 'string') {
|
if (!value || typeof value !== 'string') {
|
||||||
return null;
|
return null;
|
||||||
@@ -4645,12 +4621,6 @@ app.get('/api/files/download-url', authMiddleware, async (req, res) => {
|
|||||||
? `inline; filename*=UTF-8''${encodeURIComponent(fileName)}`
|
? `inline; filename*=UTF-8''${encodeURIComponent(fileName)}`
|
||||||
: `attachment; filename*=UTF-8''${encodeURIComponent(fileName)}`
|
: `attachment; filename*=UTF-8''${encodeURIComponent(fileName)}`
|
||||||
};
|
};
|
||||||
if (isPreviewMode) {
|
|
||||||
const previewContentType = getPreviewContentTypeByPath(fileName);
|
|
||||||
if (previewContentType) {
|
|
||||||
commandInput.ResponseContentType = previewContentType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const command = new GetObjectCommand(commandInput);
|
const command = new GetObjectCommand(commandInput);
|
||||||
|
|
||||||
// 生成签名 URL(1小时有效)
|
// 生成签名 URL(1小时有效)
|
||||||
|
|||||||
Reference in New Issue
Block a user