From ec9c648ab4fd862c6cdd10555a070773745d4bc7 Mon Sep 17 00:00:00 2001 From: Michael Bond Date: Wed, 16 Aug 2017 11:26:51 -0700 Subject: [PATCH] Fix: Files must have .360 before extension to launch in 360 viewers. --- src/lib/__tests__/util-test.js | 18 ++++++------------ src/lib/util.js | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/lib/__tests__/util-test.js b/src/lib/__tests__/util-test.js index 3a5fe7f28..43a534ba7 100644 --- a/src/lib/__tests__/util-test.js +++ b/src/lib/__tests__/util-test.js @@ -511,8 +511,12 @@ describe('lib/util', () => { }); describe('requires360Viewer()', () => { - it('should return true for file name with 360 before extension', () => { - expect(util.requires360Viewer({ name: '360.foo' })).to.be.true; + it('should return true for file name with .360 before extension', () => { + expect(util.requires360Viewer({ name: 'name.360.foo' })).to.be.true; + }); + + it('should return false for file name ending with 360 (e.g. IMG_0360.jpg)', () => { + expect(util.requires360Viewer({ name: 'IMG_0360.foo' })).to.be.false; }); it('should return false for file name with no 360 before extension', () => { @@ -557,14 +561,4 @@ describe('lib/util', () => { expect(element.style.height).to.equal(`${height}px`); }); }); - - describe('requires360Viewer()', () => { - it('should return true for file name with 360 before extension', () => { - expect(util.requires360Viewer({ name: '360.foo' })).to.be.true; - }); - - it('should return false for file name with no 360 before extension', () => { - expect(util.requires360Viewer({ name: 'foo' })).to.be.false; - }); - }); }); diff --git a/src/lib/util.js b/src/lib/util.js index d04e2ee98..74a37824c 100644 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -616,7 +616,7 @@ export function requires360Viewer(file) { // For now, we'll only support this preview if the filename has a secondary // extension of '360' (e.g. file.360.mp4) const basename = file.name.slice(0, file.name.lastIndexOf('.')); - return basename.endsWith('360'); + return basename.endsWith('.360'); } /**