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
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m57s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { normalizeAvatarUrl } from "@/lib/avatars";
|
||||
|
||||
interface AvatarProps {
|
||||
src: string | null | undefined;
|
||||
@@ -42,7 +43,8 @@ export default function Avatar({
|
||||
}, [src]);
|
||||
|
||||
const sizeClass = sizeClasses[size];
|
||||
const displaySrc = src && !avatarError ? src : null;
|
||||
const normalizedSrc = normalizeAvatarUrl(src);
|
||||
const displaySrc = normalizedSrc && !avatarError ? normalizedSrc : null;
|
||||
const initial = fallbackText || username.charAt(0).toUpperCase();
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user