fix(file-manager): when the endpoint is an empty string, set it to undefined

This commit is contained in:
chenos 2024-11-23 14:19:57 +08:00
parent e7e7c6dc00
commit 6bf52c2eef
2 changed files with 3 additions and 1 deletions

View File

@ -100,7 +100,7 @@ async function multipart(ctx: Context, next: Next) {
return ctx.throw(400, err); return ctx.throw(400, err);
} }
ctx.logger.error(err); ctx.logger.error(err);
return ctx.throw(500); return ctx.throw(500, err);
} }
const values = getFileData(ctx); const values = getFileData(ctx);

View File

@ -19,6 +19,8 @@ export default class extends StorageType {
const { accessKeyId, secretAccessKey, bucket, acl = 'public-read', ...options } = storage.options; const { accessKeyId, secretAccessKey, bucket, acl = 'public-read', ...options } = storage.options;
if (options.endpoint) { if (options.endpoint) {
options.forcePathStyle = true; options.forcePathStyle = true;
} else {
options.endpoint = undefined;
} }
const s3 = new S3Client({ const s3 = new S3Client({
...options, ...options,