diff --git a/src/controllers/product/product-controller.ts b/src/controllers/product/product-controller.ts index d9b035b..6bb2aeb 100644 --- a/src/controllers/product/product-controller.ts +++ b/src/controllers/product/product-controller.ts @@ -125,11 +125,12 @@ export class ProductController extends Controller { @Get("{productId}/image") async getProductImageById(@Request() req: RequestWithUser, @Path() productId: string) { const url = await presignedGetObjectIfExist(MINIO_BUCKET, imageLocation(productId), 60 * 60); + if (!url) { throw new HttpError(HttpStatus.NOT_FOUND, "Image cannot be found", "imageNotFound"); } - return; + return req.res?.redirect(url); } @Post()