Skip to content

Commit

Permalink
fix card / cover rendering bug (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkas authored Dec 16, 2024
1 parent d5c5161 commit c6fe6c8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 12 additions & 12 deletions apps/web/app/(basenames)/name/[username]/opengraph-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,20 @@ export default async function OpenGraphImage(props: ImageRouteProps) {
universalResolverAddress: USERNAME_L2_RESOLVER_ADDRESSES[chain.id],
});

if (!avatar) return;

// IPFS Resolution
if (IsValidIpfsUrl(avatar)) {
const ipfsUrl = getIpfsGatewayUrl(avatar as IpfsUrl);
if (ipfsUrl) {
imageSource = ipfsUrl;
if (avatar) {
// IPFS Resolution
if (IsValidIpfsUrl(avatar)) {
const ipfsUrl = getIpfsGatewayUrl(avatar as IpfsUrl);
if (ipfsUrl) {
imageSource = ipfsUrl;
}
} else {
imageSource = avatar;
}
} else {
imageSource = avatar;
}

// Cloudinary resize / fetch
imageSource = getCloudinaryMediaUrl({ media: imageSource, format: 'png', width: 80 });
// Cloudinary resize / fetch
imageSource = getCloudinaryMediaUrl({ media: imageSource, format: 'png', width: 80 });
}
} catch (error) {
logger.error('Error fetching basename Avatar:', error);
}
Expand Down
24 changes: 12 additions & 12 deletions apps/web/pages/api/basenames/[name]/assets/cardImage.svg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ export default async function handler(request: NextRequest) {
universalResolverAddress: USERNAME_L2_RESOLVER_ADDRESSES[chain.id],
});

if (!avatar) return;

// IPFS Resolution
if (IsValidIpfsUrl(avatar)) {
const ipfsUrl = getIpfsGatewayUrl(avatar as IpfsUrl);
if (ipfsUrl) {
imageSource = ipfsUrl;
if (avatar) {
// IPFS Resolution
if (avatar && IsValidIpfsUrl(avatar)) {
const ipfsUrl = getIpfsGatewayUrl(avatar as IpfsUrl);
if (ipfsUrl) {
imageSource = ipfsUrl;
}
} else if (avatar) {
imageSource = avatar;
}
} else {
imageSource = avatar;
}

// Cloudinary resize / fetch
imageSource = getCloudinaryMediaUrl({ media: imageSource, format: 'png', width: 120 });
// Cloudinary resize / fetch
imageSource = getCloudinaryMediaUrl({ media: imageSource, format: 'png', width: 120 });
}
} catch (error) {
logger.error('Error fetching basename Avatar:', error);
}
Expand Down

0 comments on commit c6fe6c8

Please sign in to comment.