diff --git a/js/components/ascribe_detail/media_container.js b/js/components/ascribe_detail/media_container.js index c414dee2..de6d8976 100644 --- a/js/components/ascribe_detail/media_container.js +++ b/js/components/ascribe_detail/media_container.js @@ -68,19 +68,21 @@ let MediaContainer = React.createClass({ isVideoEncoding() { const { content: { digital_work: digitalWork } } = this.props; - return digitalWork.mime === 'video' && digitalWork.isEncoding === 'number' && digitalWork.isEncoding !== 100; + return digitalWork.mime === 'video' && typeof digitalWork.isEncoding === 'number' && digitalWork.isEncoding !== 100; }, isImageEncoding() { const { content: { thumbnail, digital_work: digitalWork } } = this.props; - const thumbnailFileExtension = extractFileExtensionFromUrl(thumbnail.thumbnail_sizes['600x600']); + const thumbnailToCheck = thumbnail.thumbnail_sizes && thumbnail.thumbnail_sizes['600x600'] ? thumbnail.thumbnail_sizes['600x600'] + : thumbnail.url; + const thumbnailFileExtension = extractFileExtensionFromUrl(thumbnailToCheck); return digitalWork.mime === 'image' && (thumbnailFileExtension === 'tif' || thumbnailFileExtension === 'tiff'); }, getEncodingMessage() { if (this.isVideoEncoding()) { - const { digital_work: digitalWork } = this.props; + const { content: { digital_work: digitalWork } } = this.props; return (
diff --git a/js/components/ascribe_media/media_player.js b/js/components/ascribe_media/media_player.js index 4cfb4bc2..888e148f 100644 --- a/js/components/ascribe_media/media_player.js +++ b/js/components/ascribe_media/media_player.js @@ -68,10 +68,10 @@ let Image = React.createClass({ render() { const { url, thumbnail } = this.props; - const urlFileExtension = extractFileExtensionFromUrl(url); // TIFFs can not be displayed by the browser, so we just display their thumbnail - if (url && urlFileExtension !== 'tif' && urlFileExtension !== 'tiff') { + // url is not necessarily defined, which would cause this function to fail + if (url && extractFileExtensionFromUrl(url) !== 'tif' && extractFileExtensionFromUrl(url) !== 'tiff') { return ( );