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
e2c4c512ba
commit
01844aef53
@ -34,7 +34,7 @@ export default class Identicon extends PureComponent {
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -76,7 +76,14 @@ export default class Identicon extends PureComponent {
|
||||
const { className, diameter, alt, imageBorder, ipfsGateway } = 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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user