Fix photo URL construction in ReportDetailModal

- Prepend API base URL to relative photo paths
- Use process.cwd() for upload directory in server
- Ensures photos display correctly in report detail modal
This commit is contained in:
2025-11-16 22:57:40 +00:00
parent 4e5ab7d41b
commit 55acff59bc
2 changed files with 8 additions and 3 deletions

View File

@@ -125,7 +125,11 @@ export function ReportDetailModal({ report, isOpen, onClose, onVerify, onDispute
{/* Photo Gallery */}
<div className="relative bg-gray-900">
<img
src={report.photoUrls[currentPhotoIndex]}
src={
report.photoUrls[currentPhotoIndex].startsWith('http')
? report.photoUrls[currentPhotoIndex]
: `${(import.meta.env.VITE_API_BASE_URL || 'http://localhost:3005/api').replace('/api', '')}${report.photoUrls[currentPhotoIndex]}`
}
alt={`Report photo ${currentPhotoIndex + 1}`}
className="w-full h-80 object-contain"
/>