Skip to content

Commit

Permalink
allow ; in fragments
Browse files Browse the repository at this point in the history
>Aside from dot-segments in hierarchical paths, a path segment is considered opaque by the generic syntax.  URI producing applications often use the reserved characters allowed in a segment to delimit scheme-specific or dereference-handler-specific subcomponents.  For example, the semicolon (";") and equals ("=") reserved characters are often used to delimit parameters and parameter values applicable to that segment.
  • Loading branch information
Tom Jenkinson committed Aug 29, 2018
1 parent 3fc6e15 commit 2488e87
Show file tree
Hide file tree
Showing 2 changed files with 3 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 @@ -4,7 +4,7 @@
(function(root) {
/* jshint ignore:end */

var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/;
var URL_REGEX = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/;
var FIRST_SEGMENT_REGEX = /^([^\/;?#]*)(.*)$/;
var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g;
var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g;
Expand Down
2 changes: 2 additions & 0 deletions test/url-toolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ describe('url toolkit', function() {
test('http://a.com/b/cd/e.m3u8?test=1#something', 'a_:b', 'http://a.com/b/cd/a_:b');
test('http://a.com/b/cd/e.m3u8?test=1#something', 'a:b', 'a:b');
test('http://a.com/b/cd/e.m3u8?test=1#something', './a:b', 'http://a.com/b/cd/a:b');

test('http://a.com/expiretime=111;dirmatch=true/master.m3u8', './a:b', 'http://a.com/expiretime=111;dirmatch=true/a:b');
});
});

Expand Down

0 comments on commit 2488e87

Please sign in to comment.