diff --git a/frontend/src/js/component/wb-collection-content.js b/frontend/src/js/component/wb-collection-content.js index 7c0d301..66f6042 100644 --- a/frontend/src/js/component/wb-collection-content.js +++ b/frontend/src/js/component/wb-collection-content.js @@ -15,6 +15,14 @@ function encodeURIComponentIncludingDots(s) { return encodeURIComponent(s).replace('.', '%2E'); } +function endsWith(what, endings) { + if (typeof(endings) === 'string') + return what.endsWith(endings); + if (endings instanceof Array) + return endings.map(a => what.endsWith(a)).reduce((a, b) => (a || b)); + throw Error('Expected second argument to be either a string or an array'); +} + class WBCollectionContent extends Component { constructor(...args) { super(...args); @@ -143,7 +151,7 @@ class WBCollectionContent extends Component { alert('Not implemented.') } }> - { item[1].toLowerCase().endsWith('.nii') ? ( + { endsWith(item[1].toLowerCase(), ['.nii', '.nii.gz']) ? ( + }) }> ) : null } ) : null)