mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Handling array type values for image in Identicon component (#13484)
* Handling array type values for image in Identicon component * Adding additional type check
This commit is contained in:
parent
cc1861a34e
commit
5e07c0768b
@ -34,7 +34,7 @@ export default class Identicon extends PureComponent {
|
|||||||
/**
|
/**
|
||||||
* Used as the image source of the Identicon
|
* Used as the image source of the Identicon
|
||||||
*/
|
*/
|
||||||
image: PropTypes.string,
|
image: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
||||||
/**
|
/**
|
||||||
* Use the blockie type random image generator
|
* Use the blockie type random image generator
|
||||||
*/
|
*/
|
||||||
@ -76,7 +76,14 @@ export default class Identicon extends PureComponent {
|
|||||||
const { className, diameter, alt, imageBorder, ipfsGateway } = this.props;
|
const { className, diameter, alt, imageBorder, ipfsGateway } = this.props;
|
||||||
let { image } = this.props;
|
let { image } = this.props;
|
||||||
|
|
||||||
if (image.toLowerCase().startsWith('ipfs://')) {
|
if (Array.isArray(image) && image.length) {
|
||||||
|
image = image[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof image === 'string' &&
|
||||||
|
image.toLowerCase().startsWith('ipfs://')
|
||||||
|
) {
|
||||||
image = getAssetImageURL(image, ipfsGateway);
|
image = getAssetImageURL(image, ipfsGateway);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user