Skip to content

Commit

Permalink
Fix: Files must have .360 before extension to launch in 360 viewers. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MiiBond committed Aug 16, 2017
1 parent 37dfd4a commit 1659c4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
18 changes: 6 additions & 12 deletions src/lib/__tests__/util-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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;
});
});
});
2 changes: 1 addition & 1 deletion src/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down

0 comments on commit 1659c4d

Please sign in to comment.