Fine-tune file protocol filter

This commit is contained in:
Scott Nonnenberg 2018-05-25 14:11:26 -07:00
parent 06b0544bbe
commit eec61f5289
3 changed files with 38 additions and 16 deletions

View file

@ -34,12 +34,13 @@ describe('Protocol Filter', () => {
expect(actual).to.equal(expected);
});
it('returns proper file path for windows style file URI', () => {
it('returns proper file path for file URI on windows', () => {
const path =
'file:///C:/Users/Someone/dev/desktop/background.html?name=Signal&locale=en&version=2.4.0';
const expected = 'C:/Users/Someone/dev/desktop/background.html';
const isWindows = true;
const actual = _urlToPath(path, { isWindows: true });
const actual = _urlToPath(path, { isWindows });
expect(actual).to.equal(expected);
});
@ -72,6 +73,15 @@ describe('Protocol Filter', () => {
expect(actual).to.equal(expected);
});
it('handles SMB share path on windows', () => {
const path = 'file://relative/path';
const expected = 'elative/path';
const isWindows = true;
const actual = _urlToPath(path, { isWindows });
expect(actual).to.equal(expected);
});
it('hands back a path with .. in it', () => {
const path = 'file://../../..';
const expected = '../../..';