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" className="collectible-details__card"
> >
{image ? ( {image ? (
<img className="collectible-details__image" src={image} /> <img
className="collectible-details__image"
src={collectibleImageURL}
/>
) : ( ) : (
<CollectibleDefaultImage name={name} tokenId={tokenId} /> <CollectibleDefaultImage name={name} tokenId={tokenId} />
)} )}

View File

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