fix(torob): sanitize imageLink in Torob API and feed to always use frontend domain and proxy path
Deploy Canina / deploy (push) Successful in 1m44s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s

This commit is contained in:
parsa aghaei committed 2026-08-29 14:18:41 +03:30
1 parent 376fea356f
commit 88060431bb
14 files changed
+9023 -8720

No files matched your search

@@ -1,6 +1,7 @@
import { NextRequest, NextResponse } from 'next/server';
import { productService } from '../../../../lib/services/productService';
import { PRODUCTS } from '../../../../lib/data/products';
import { getMediaUrl } from '../../../../lib/media';
export const dynamic = 'force-dynamic';
export const revalidate = 3600;
@@ -39,11 +40,13 @@ export async function GET(request: NextRequest) {
const nameEn = product.nameEn || '';
const title = nameEn ? `${nameFa} (${nameEn})` : nameFa;
const primaryImg = product.ogImage || product.image || product.imageUrl || '';
const imageLink = primaryImg
? primaryImg.startsWith('http')
? primaryImg
: `${baseUrl}${primaryImg.startsWith('/') ? primaryImg : `/${primaryImg}`}`
: '';
let imageLink = '';
if (primaryImg) {
const proxied = getMediaUrl(primaryImg);
imageLink = proxied.startsWith('http')
? proxied
: `${baseUrl}${proxied.startsWith('/') ? proxied : `/${proxied}`}`;
}
const isInStock =
product.stockStatus !== 'OUT_OF_STOCK' &&