diff --git a/backend/src/s3/s3.service.spec.ts b/backend/src/s3/s3.service.spec.ts index be3281f..4965498 100644 --- a/backend/src/s3/s3.service.spec.ts +++ b/backend/src/s3/s3.service.spec.ts @@ -192,7 +192,7 @@ describe("S3Service", () => { return null; }); const url = service.getPublicUrl("test.webp"); - expect(url).toBe("https://api.test.com/media/test.webp"); + expect(url).toBe("https://api.test.com/media?path=test.webp"); }); it("should use DOMAIN_NAME and PORT for localhost", () => { @@ -205,7 +205,7 @@ describe("S3Service", () => { }, ); const url = service.getPublicUrl("test.webp"); - expect(url).toBe("http://localhost:3000/media/test.webp"); + expect(url).toBe("http://localhost:3000/media?path=test.webp"); }); it("should use api.DOMAIN_NAME for production", () => { @@ -217,7 +217,7 @@ describe("S3Service", () => { }, ); const url = service.getPublicUrl("test.webp"); - expect(url).toBe("https://api.memegoat.fr/media/test.webp"); + expect(url).toBe("https://api.memegoat.fr/media?path=test.webp"); }); }); }); diff --git a/backend/src/s3/s3.service.ts b/backend/src/s3/s3.service.ts index 0efa784..ab40bd0 100644 --- a/backend/src/s3/s3.service.ts +++ b/backend/src/s3/s3.service.ts @@ -173,6 +173,6 @@ export class S3Service implements OnModuleInit, IStorageService { baseUrl = `https://api.${domain}`; } - return `${baseUrl}/media/${storageKey}`; + return `${baseUrl}/media?path=${storageKey}`; } }