From 528cbc0acd5f3f8a8ae57fd6428abe223ddc1a02 Mon Sep 17 00:00:00 2001 From: Julian <115516918+juliansommer@users.noreply.github.com> Date: Wed, 28 Jan 2026 10:36:54 +1000 Subject: [PATCH] fix: buckets on hive-ui --- hive-ui/frontend/src/lib/awsClient.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hive-ui/frontend/src/lib/awsClient.ts b/hive-ui/frontend/src/lib/awsClient.ts index 91c488598..587f51b9f 100644 --- a/hive-ui/frontend/src/lib/awsClient.ts +++ b/hive-ui/frontend/src/lib/awsClient.ts @@ -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 }