Refactor image URL handling: Update API routes to return image URLs via the API instead of direct paths, ensuring consistency across avatar and background uploads. Introduce normalization functions for avatar and background URLs to maintain compatibility with existing URLs.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m57s

This commit is contained in:
Julien Froidefond
2025-12-12 15:59:18 +01:00
parent 702476c349
commit f69fbbd0e1
11 changed files with 238 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ export async function GET() {
(file) =>
file.match(/\.(jpg|jpeg|png|gif|webp|svg)$/i) && !file.startsWith(".")
);
images.push(...imageFiles.map((file) => `/uploads/backgrounds/${file}`));
images.push(...imageFiles.map((file) => `/api/backgrounds/${file}`));
}
return NextResponse.json({ images });