1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Fix #17300, #16843 - Use proper source for image of IPFS NFTs (#17302)

This commit is contained in:
David Walsh 2023-01-23 16:04:11 -06:00 committed by GitHub
parent 31aa6c079a
commit cf10b2a1a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -175,7 +175,10 @@ export default function CollectibleDetails({ collectible }) {
className="collectible-details__card"
>
{image ? (
<img className="collectible-details__image" src={image} />
<img
className="collectible-details__image"
src={collectibleImageURL}
/>
) : (
<CollectibleDefaultImage name={name} tokenId={tokenId} />
)}

View File

@ -1,5 +1,7 @@
/* eslint-disable no-negated-condition */
import React, { useState } from 'react';
import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import classnames from 'classnames';
@ -7,6 +9,7 @@ import { TransactionType } from '../../../../../../shared/constants/transaction'
import { toChecksumHexAddress } from '../../../../../../shared/modules/hexstring-utils';
import { useI18nContext } from '../../../../../hooks/useI18nContext';
import useAddressDetails from '../../../../../hooks/useAddressDetails';
import { getIpfsGateway } from '../../../../../selectors';
import Identicon from '../../../../ui/identicon';
import InfoTooltip from '../../../../ui/info-tooltip';
@ -15,6 +18,7 @@ import Typography from '../../../../ui/typography';
import { TYPOGRAPHY } from '../../../../../helpers/constants/design-system';
import { ORIGIN_METAMASK } from '../../../../../../shared/constants/app';
import SiteOrigin from '../../../../ui/site-origin';
import { getAssetImageURL } from '../../../../../helpers/utils/util';
const ConfirmPageContainerSummary = (props) => {
const {
@ -35,6 +39,7 @@ const ConfirmPageContainerSummary = (props) => {
const [showNicknamePopovers, setShowNicknamePopovers] = useState(false);
const t = useI18nContext();
const ipfsGateway = useSelector(getIpfsGateway);
const contractInitiatedTransactionType = [
TransactionType.contractInteraction,
@ -62,12 +67,14 @@ const ConfirmPageContainerSummary = (props) => {
const checksummedAddress = toChecksumHexAddress(contractAddress);
const renderImage = () => {
const imagePath = getAssetImageURL(image, ipfsGateway);
if (image) {
return (
<img
className="confirm-page-container-summary__icon"
width={36}
src={image}
src={imagePath}
/>
);
} else if (contractAddress) {
@ -76,7 +83,6 @@ const ConfirmPageContainerSummary = (props) => {
className="confirm-page-container-summary__icon"
diameter={36}
address={contractAddress}
image={image}
/>
);
}