Skip to content

Commit

Permalink
fix error when normalizing and relative url empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Jenkinson committed Jan 21, 2018
1 parent 34f3d14 commit 0b7113f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/url-toolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
return baseURL;
}
var basePartsForNormalise = this.parseURL(baseURL);
if (!baseParts) {
if (!basePartsForNormalise) {
throw new Error('Error trying to parse base URL.');
}
basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path);
Expand Down
3 changes: 3 additions & 0 deletions test/url-toolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ describe('url toolkit', function() {
test('http://a/b/c/d;p?q#f', 'http:', 'http:');

// Custom
test('http://a.com/b/cd/./e.m3u8?test=1#something', '', 'http://a.com/b/cd/./e.m3u8?test=1#something');
test('http://a.com/b/cd/./e.m3u8?test=1#something', '', 'http://a.com/b/cd/e.m3u8?test=1#something', { alwaysNormalize: true });

test('http://a.com/b/cd/e.m3u8', 'https://example.com/z.ts', 'https://example.com/z.ts');
test('http://a.com/b/cd/e.m3u8', 'g:h', 'g:h');
test('http://a.com/b/cd/e.m3u8', 'https://example.com:8080/z.ts', 'https://example.com:8080/z.ts');
Expand Down

0 comments on commit 0b7113f

Please sign in to comment.