Skip to content

Commit

Permalink
fix: special characters breaking image preview. Closes #492
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeluigi committed May 29, 2024
1 parent 40cc144 commit 2cf1d57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/CardTooltip/CardTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Props = {
};

const CardTooltip = ({ cardName, children }: Props) => {
const url = cardName ? `https://api.scryfall.com/cards/named?format=image&version=normal&exact=${cardName}` : "";
const url = cardName ? `https://api.scryfall.com/cards/named?format=image&version=normal&exact=${encodeURIComponent(cardName)}` : "";

const divRef = useRef<HTMLDivElement>(null);

Expand Down
4 changes: 2 additions & 2 deletions src/pages/combo/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const Combo = ({ combo, alternatives }: Props) => {
const cards = combo.uses.map((card) => {
return {
name: card.card.name,
artUrl: `https://api.scryfall.com/cards/named?format=image&version=art_crop&exact=${card.card.name}`,
oracleImageUrl: `https://api.scryfall.com/cards/named?format=image&version=normal&exact=${card.card.name}`,
artUrl: `https://api.scryfall.com/cards/named?format=image&version=art_crop&exact=${encodeURIComponent(card.card.name)}`,
oracleImageUrl: `https://api.scryfall.com/cards/named?format=image&version=normal&exact=${encodeURIComponent(card.card.name)}`,
};
});
const cardNames = combo.uses.map(card => card.card.name);
Expand Down

0 comments on commit 2cf1d57

Please sign in to comment.