From 338075af2da116d7b51fab6ee6398320f4f8141c Mon Sep 17 00:00:00 2001 From: schererleander Date: Fri, 26 Dec 2025 18:08:53 +0100 Subject: fix(storage): improve minio URL construction for production --- src/lib/minio.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lib/minio.ts') diff --git a/src/lib/minio.ts b/src/lib/minio.ts index 030ae05..f92f4ed 100644 --- a/src/lib/minio.ts +++ b/src/lib/minio.ts @@ -24,7 +24,11 @@ export async function uploadToMinio( 'Cache-Control': 'max-age=31536000', // 1 year cache }) - const url = `${process.env.MINIO_ENDPOINT ? `http://${process.env.MINIO_ENDPOINT}:9000` : 'http://localhost:9000'}/${BUCKET_NAME}/${key}` + // Construct URL using the same configuration as the client + const protocol = process.env.NODE_ENV === 'production' ? 'https' : 'http' + const host = process.env.MINIO_ENDPOINT_HOST || 'localhost' + const port = process.env.MINIO_ENDPOINT_PORT || '9000' + const url = `${protocol}://${host}:${port}/${BUCKET_NAME}/${key}` return url } catch (error) { -- cgit v1.3.1