MediaGallery: fix audio attachment thumb crash
This commit is contained in:
parent
135ec190ee
commit
583aa6fd60
1 changed files with 3 additions and 6 deletions
|
@ -197,21 +197,18 @@ class Item extends React.PureComponent {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (attachment.get('type') === 'audio') {
|
} else if (attachment.get('type') === 'audio') {
|
||||||
const remoteURL = attachment.get('remote_url');
|
const ext = attachment.get('url').split('.').pop().toUpperCase();
|
||||||
const originalUrl = attachment.get('url');
|
|
||||||
const fileExtensionLastIndex = remoteURL.lastIndexOf('.');
|
|
||||||
const fileExtension = remoteURL.substr(fileExtensionLastIndex + 1).toUpperCase();
|
|
||||||
thumbnail = (
|
thumbnail = (
|
||||||
<a
|
<a
|
||||||
className={classNames('media-gallery__item-thumbnail')}
|
className={classNames('media-gallery__item-thumbnail')}
|
||||||
href={attachment.get('remote_url') || originalUrl}
|
href={attachment.get('url')}
|
||||||
onClick={this.handleClick}
|
onClick={this.handleClick}
|
||||||
target='_blank'
|
target='_blank'
|
||||||
alt={attachment.get('description')}
|
alt={attachment.get('description')}
|
||||||
title={attachment.get('description')}
|
title={attachment.get('description')}
|
||||||
>
|
>
|
||||||
<span className='media-gallery__item__icons'><Icon id='volume-up' /></span>
|
<span className='media-gallery__item__icons'><Icon id='volume-up' /></span>
|
||||||
<span className='media-gallery__file-extension__label'>{fileExtension}</span>
|
<span className='media-gallery__file-extension__label'>{ext}</span>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
} else if (attachment.get('type') === 'video') {
|
} else if (attachment.get('type') === 'video') {
|
||||||
|
|
Loading…
Reference in a new issue