Skip to content

Commit

Permalink
Merge pull request #2764 from near/bugfix
Browse files Browse the repository at this point in the history
fix: do not break page when mediaUrl is undefined
  • Loading branch information
judith-Near authored Jun 20, 2022
2 parents 02eb865 + cd52252 commit 7920c9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/frontend/src/components/nft/NFTMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export function NFTMedia({ mediaUrl, autoPlay = false }) {
const [isVideo, mimeType] = useMemo(() => {
let mimeType;
// check mediaUrl string for .webm or .mp4 endings (case-insensitive)
if (mediaUrl.match(/\.webm$/i)) mimeType = 'webm';
else if (mediaUrl.match(/\.mp4$/i)) mimeType = 'mp4';
if (mediaUrl && mediaUrl.match(/\.webm$/i)) mimeType = 'webm';
else if (mediaUrl && mediaUrl.match(/\.mp4$/i)) mimeType = 'mp4';
// if there is a mediaUrl and a truthy mimeType (webm or mp4), we have a video
const isVideo = !!mediaUrl && mimeType;
return [isVideo, mimeType];
Expand Down

0 comments on commit 7920c9b

Please sign in to comment.