From 0885195cb5661af1444657278811bb0ac5eaa257 Mon Sep 17 00:00:00 2001 From: yuyx <237899745@qq.com> Date: Tue, 17 Feb 2026 19:51:01 +0800 Subject: [PATCH] fix: remove preview content-type override for aliyun oss compatibility --- backend/server.js | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/backend/server.js b/backend/server.js index 07c6567..3c8f7b9 100644 --- a/backend/server.js +++ b/backend/server.js @@ -686,30 +686,6 @@ function getBusyDownloadMessage() { 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) { if (!value || typeof value !== 'string') { return null; @@ -4645,12 +4621,6 @@ app.get('/api/files/download-url', authMiddleware, async (req, res) => { ? `inline; 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); // 生成签名 URL(1小时有效)