fix: resolve 404 for DynamicLogo by using openinaryLoader and fixing path prefix
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import openinaryLoader from '../lib/openinary-loader';
|
||||
|
||||
interface DynamicLogoProps {
|
||||
src: string;
|
||||
color?: string;
|
||||
@@ -17,13 +19,16 @@ export default function DynamicLogo({
|
||||
size = "contain",
|
||||
className = ""
|
||||
}: DynamicLogoProps) {
|
||||
|
||||
const imageUrl = src.startsWith('/') ? openinaryLoader({ src, width: 800 }) : src;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
style={{
|
||||
backgroundColor: color,
|
||||
maskImage: `url(${src})`,
|
||||
WebkitMaskImage: `url(${src})`,
|
||||
maskImage: `url(${imageUrl})`,
|
||||
WebkitMaskImage: `url(${imageUrl})`,
|
||||
maskRepeat: "no-repeat",
|
||||
maskPosition: "center",
|
||||
maskSize: size,
|
||||
|
||||
@@ -30,8 +30,10 @@ export default function openinaryLoader({ src, width, quality }: { src: string,
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
// Clean up any leading slash
|
||||
if (path.startsWith('/')) {
|
||||
// Clean up any leading slash and the /t/ prefix if present
|
||||
if (path.startsWith('/t/')) {
|
||||
path = path.substring(3);
|
||||
} else if (path.startsWith('/')) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user