Fix image URLs: handle paths with or without leading slash
All checks were successful
Build frontend / build (push) Successful in 39s

Some API paths have / (e.g. /Pictures/abc.jpg) and some don't (e.g. scaled_photo.jpg).
Now always inserts / between API base and path.
This commit is contained in:
Claw AI
2026-03-30 01:35:20 +00:00
parent 9d671f1985
commit 722d69cc92
4 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ function mapApiProperty(item, index) {
const apiBase = typeof window !== 'undefined' ? (process.env.NEXT_PUBLIC_API_URL || 'http://45.93.137.91/api') : '';
const rawImages = Array.isArray(info.images) ? info.images : [];
const images = rawImages.length > 0
? rawImages.map(img => img.startsWith('http') ? img : `${apiBase}${img}`)
? rawImages.map(img => img.startsWith('http') ? img : `${apiBase}${img.startsWith('/') ? '' : '/'}${img}`)
: ['/property-placeholder.jpg'];
return {