From 32f4e9c40fd81b084d63d97a7ebfcbcaa2343e49 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Fri, 6 Feb 2026 19:45:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20S3=20=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=8A=A8=E6=80=81=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=20forcePathStyle=20=E5=B1=9E=E6=80=A7=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20Minio,=20=E6=9A=82=E6=97=B6=E5=8F=AA?= =?UTF-8?q?=E5=8F=91=E7=8E=B0minio=E9=9C=80=E8=A6=81frocePathSylte?= =?UTF-8?q?=EF=BC=8Ctos=E4=B8=8D=E9=9C=80=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/fm-manager/proxy/http-proxy.ts | 2 ++ src/modules/s3.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/fm-manager/proxy/http-proxy.ts b/src/modules/fm-manager/proxy/http-proxy.ts index 55521b4..ba939f5 100644 --- a/src/modules/fm-manager/proxy/http-proxy.ts +++ b/src/modules/fm-manager/proxy/http-proxy.ts @@ -46,6 +46,7 @@ export async function minioProxy( const fileUrl = opts.proxyUrl; const { createNotFoundPage, isDownload = false } = opts; const objectName = fileUrl.replace(minioResources + '/', ''); + console.log('proxy url objectName', objectName) try { const stat = await oss.statObject(objectName); if (stat?.size === 0) { @@ -124,6 +125,7 @@ export const httpProxy = async ( const params = _u.searchParams; const isDownload = params.get('download') === 'true'; if (proxyUrl.startsWith(minioResources)) { + console.log('isMinio', proxyUrl) const isOk = await minioProxy(req, res, { ...opts, isDownload }); if (!isOk) { userApp.clearCacheData(); diff --git a/src/modules/s3.ts b/src/modules/s3.ts index d84efd2..1405095 100644 --- a/src/modules/s3.ts +++ b/src/modules/s3.ts @@ -5,6 +5,7 @@ const config = useConfig(); export const bucketName = config.S3_BUCKET_NAME || 'resources'; +const isMinio = config.S3_ENDPOINT?.includes?.('9000'); export const s3Client = new S3Client({ credentials: { accessKeyId: config.S3_ACCESS_KEY_ID || '', @@ -13,7 +14,7 @@ export const s3Client = new S3Client({ region: config.S3_REGION, endpoint: config.S3_ENDPOINT, // minio配置 - forcePathStyle: true, + forcePathStyle: isMinio ? true : undefined, }); // 判断 bucketName 是否存在,不存在则创建