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

@ -749,7 +749,7 @@ export default function OwnerPropertiesPage() {
images: (() => {
const apiBase = typeof window !== 'undefined' ? (process.env.NEXT_PUBLIC_API_URL || 'http://45.93.137.91/api') : '';
const raw = Array.isArray(info.images) ? info.images : [];
return raw.length > 0 ? raw.map(img => img.startsWith('http') ? img : `${apiBase}${img}`) : ['/property-placeholder.jpg'];
return raw.length > 0 ? raw.map(img => img.startsWith('http') ? img : `${apiBase}${img.startsWith('/') ? '' : '/'}${img}`) : ['/property-placeholder.jpg'];
})(),
createdAt: item.createdAt || new Date().toISOString(),
furnished: details.furnished || false,