Fix asset paths (#623)

This commit is contained in:
Chris 2025-11-30 17:07:03 +02:00 committed by GitHub
parent bfeffa069f
commit f663ad5d52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 4 deletions

View file

@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from 'react';
import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
import { getPresetBanners, PresetBanner } from '../../utils/bannersService';
import { getApiPath } from '../../config/paths';
import { getApiPath, getAssetPath } from '../../config/paths';
interface BannerEditModalProps {
isOpen: boolean;
@ -225,7 +225,15 @@ const BannerEditModal: React.FC<BannerEditModalProps> = ({
</h3>
<div className="relative inline-block w-full">
<img
src={imagePreview}
src={
imagePreview.startsWith(
'data:'
)
? imagePreview
: getAssetPath(
imagePreview
)
}
alt="Banner preview"
className="w-full h-48 object-cover rounded-md border border-gray-300 dark:border-gray-600"
/>
@ -265,7 +273,9 @@ const BannerEditModal: React.FC<BannerEditModalProps> = ({
}`}
>
<img
src={banner.url}
src={getAssetPath(
banner.url
)}
alt={`Banner by ${banner.creator}`}
className="w-full h-24 object-cover"
/>

View file

@ -16,6 +16,7 @@ import {
getCreatorFromBannerUrl,
isPresetBanner,
} from '../../utils/bannersService';
import { getAssetPath } from '../../config/paths';
interface ProjectBannerProps {
project: Project;
@ -47,7 +48,7 @@ const ProjectBanner: React.FC<ProjectBannerProps> = ({
<div className="mb-6 overflow-hidden relative group">
{project.image_url ? (
<img
src={project.image_url}
src={getAssetPath(project.image_url)}
alt={project.name}
className="w-full h-[282px] object-cover"
/>