fix: resolve 404 for DynamicLogo by using openinaryLoader and fixing path prefix
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user