Skip to content

Commit 13a3d27

Browse files
committed
Fix regex for file extension match.
1 parent 97a0274 commit 13a3d27

File tree

6 files changed

+11
-5
lines changed

6 files changed

+11
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-url",
3-
"version": "2.5.2",
3+
"version": "2.5.3",
44
"description": "A simple, lightweight url parser for JavaScript (~1.7 Kb minified, ~0.7Kb gzipped).",
55
"main": "url.js",
66
"repository": {

tests.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ test('file', function() {
176176
deepEqual( window.url( 'file', 'http://domain.com' ), undefined );
177177
deepEqual( window.url( 'filename', 'http://domain.com' ), undefined );
178178
deepEqual( window.url( 'fileext', 'http://domain.com' ), undefined );
179+
deepEqual( window.url( 'file', 'http://domain.com/some.file.png' ), 'some.file.png' );
180+
deepEqual( window.url( 'filename', 'http://domain.com/some.file.png' ), 'some.file' );
181+
deepEqual( window.url( 'fileext', 'http://domain.com/some.file.png' ), 'png' );
182+
deepEqual( window.url( 'file', 'http://domain.com/.png' ), '.png' );
183+
deepEqual( window.url( 'filename', 'http://domain.com/.png' ), '' );
184+
deepEqual( window.url( 'fileext', 'http://domain.com/.png' ), 'png' );
179185
});
180186

181187
test('url parts', function() {

url-tld.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

url.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"websanova",
77
"url"
88
],
9-
"version": "2.5.2",
9+
"version": "2.5.3",
1010
"author": {
1111
"name": "Websanova",
1212
"email": "rob@websanova.com",

url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
// File.
124124
tmp = _i('/-1', _l.path.substring(1));
125125

126-
if (tmp && (tmp = tmp.match(/(.*?)\.(.*)/))) {
126+
if (tmp && (tmp = tmp.match(/(.*?)\.([^.]+)$/))) {
127127
_l.file = tmp[0];
128128
_l.filename = tmp[1];
129129
_l.fileext = tmp[2];

url.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)