fix: resolve 404 for DynamicLogo by using openinaryLoader and fixing path prefix

This commit is contained in:
Mustafa Yildiz
2026-07-18 14:53:27 +03:00
parent ab184529eb
commit 392ada664d
2 changed files with 11 additions and 4 deletions
+7 -2
View File
@@ -1,5 +1,7 @@
"use client"; "use client";
import openinaryLoader from '../lib/openinary-loader';
interface DynamicLogoProps { interface DynamicLogoProps {
src: string; src: string;
color?: string; color?: string;
@@ -17,13 +19,16 @@ export default function DynamicLogo({
size = "contain", size = "contain",
className = "" className = ""
}: DynamicLogoProps) { }: DynamicLogoProps) {
const imageUrl = src.startsWith('/') ? openinaryLoader({ src, width: 800 }) : src;
return ( return (
<div <div
className={className} className={className}
style={{ style={{
backgroundColor: color, backgroundColor: color,
maskImage: `url(${src})`, maskImage: `url(${imageUrl})`,
WebkitMaskImage: `url(${src})`, WebkitMaskImage: `url(${imageUrl})`,
maskRepeat: "no-repeat", maskRepeat: "no-repeat",
maskPosition: "center", maskPosition: "center",
maskSize: size, maskSize: size,
+4 -2
View File
@@ -30,8 +30,10 @@ export default function openinaryLoader({ src, width, quality }: { src: string,
return url.toString(); return url.toString();
} }
// Clean up any leading slash // Clean up any leading slash and the /t/ prefix if present
if (path.startsWith('/')) { if (path.startsWith('/t/')) {
path = path.substring(3);
} else if (path.startsWith('/')) {
path = path.substring(1); path = path.substring(1);
} }