fix: buckets on hive-ui

This commit is contained in:
Julian
2026-01-28 10:36:54 +10:00
parent 8f0e8d7ead
commit 528cbc0acd
+17
View File
@@ -40,6 +40,23 @@ export function getS3Client(): S3Client {
},
forcePathStyle: true,
})
// Remove trailing slashes from request paths to fix compatibility with
// path-style S3 endpoints where a trailing slash causes the request to
// be interpreted as GetObject instead of ListObjects
s3Client.middlewareStack.use({
applyToStack: (stack) => {
stack.add(
(next) => (args) => {
const request = (args as { request?: { path?: string } }).request
if (request?.path?.endsWith("/") && request.path !== "/") {
request.path = request.path.slice(0, -1)
}
return next(args)
},
{ step: "build", name: "removeTrailingSlash" },
)
},
})
}
return s3Client
}