Skip to content

Commit

Permalink
Offline sprites (#4649)
Browse files Browse the repository at this point in the history
* Test case

* Fixture
  • Loading branch information
oscarfonts authored and mourner committed Apr 27, 2017
1 parent 89ae6a2 commit 495a695
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function replaceTempAccessToken(params: Array<string>) {
}
}

const urlRe = /^(\w+):\/\/([^/?]+)(\/[^?]+)?\??(.+)?/;
const urlRe = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;

function parseUrl(url: string): UrlObject {
const parts = url.match(urlRe);
Expand Down
5 changes: 5 additions & 0 deletions test/unit/util/mapbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ test("mapbox", (t) => {
t.end();
});

t.test('concantenates path, ratio, and extension for file:/// scheme', (t) => {
t.equal(mapbox.normalizeSpriteURL('file:///path/to/bar', '@2x', '.png'), 'file:///path/to/bar@2x.png');
t.end();
});

t.test('normalizes non-mapbox:// scheme when query string exists', (t) => {
t.equal(mapbox.normalizeSpriteURL('http://www.foo.com/bar?fresh=true', '@2x', '.png'), 'http://www.foo.com/bar@2x.png?fresh=true');
t.end();
Expand Down

0 comments on commit 495a695

Please sign in to comment.