diff --git a/README.md b/README.md index f009efd0..d1dea593 100644 --- a/README.md +++ b/README.md @@ -974,8 +974,16 @@ Web端在登录页面输入你的**认证码**即可登录使用;API端需要
- -
暔晓
+ + +
暔晓
+
+
+
+ + +
狐狸汉克
+
diff --git a/functions/api/manage/delete/[id].js b/functions/api/manage/delete/[id].js index d4975a14..b02e930f 100644 --- a/functions/api/manage/delete/[id].js +++ b/functions/api/manage/delete/[id].js @@ -36,7 +36,6 @@ export async function onRequest(context) { accessKeyId: img.metadata?.S3AccessKeyId, secretAccessKey: img.metadata?.S3SecretAccessKey }, - forcePathStyle: true }); const bucketName = img.metadata?.S3BucketName; diff --git a/functions/file/[id].js b/functions/file/[id].js index 9bd06918..352983dd 100644 --- a/functions/file/[id].js +++ b/functions/file/[id].js @@ -112,8 +112,7 @@ export async function onRequest(context) { // Contents of context object credentials: { accessKeyId: imgRecord.metadata?.S3AccessKeyId, secretAccessKey: imgRecord.metadata?.S3SecretAccessKey - }, - forcePathStyle: true + } }); const bucketName = imgRecord.metadata?.S3BucketName; diff --git a/functions/upload.js b/functions/upload.js index d8106f40..770c5982 100644 --- a/functions/upload.js +++ b/functions/upload.js @@ -333,8 +333,7 @@ async function uploadFileToS3(env, formdata, fullId, metadata, returnLink, origi credentials: { accessKeyId, secretAccessKey - }, - forcePathStyle: true // 确保使用路径风格(适配 R2、MinIO) + } }); // 获取文件 @@ -363,7 +362,8 @@ async function uploadFileToS3(env, formdata, fullId, metadata, returnLink, origi metadata.Channel = "S3"; metadata.ChannelName = s3Channel.name; - metadata.S3Location = `${endpoint}/${bucketName}/${s3FileName}`; + const s3ServerDomain = endpoint.replace(/https?:\/\//, ""); + metadata.S3Location = `https://${bucketName}.${s3ServerDomain}/${s3FileName}`; // 采用虚拟主机风格的 URL metadata.S3Endpoint = endpoint; metadata.S3AccessKeyId = accessKeyId; metadata.S3SecretAccessKey = secretAccessKey;