Skip to content

Commit

Permalink
Merge pull request #200 from giltayar/master
Browse files Browse the repository at this point in the history
Fixed bug whereby absoluteTo failed on a root base
  • Loading branch information
rodneyrehm committed Mar 31, 2015
2 parents 55d5a98 + b4eeb3f commit 20d6b72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@

if (resolved.path().charAt(0) !== '/') {
basedir = base.directory();
basedir = basedir ? basedir : base.path().indexOf('/') === 0 ? '/' : '';
resolved._parts.path = (basedir ? (basedir + '/') : '') + resolved._parts.path;
resolved.normalizePath();
}
Expand Down
10 changes: 10 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,16 @@
url: './relative/path?blubber=1#hash3',
base: '/path/to/file?some=query#hash',
result: '/path/to/relative/path?blubber=1#hash3'
}, {
name: 'path-relative path resolve 2',
url: 'tofile',
base: '/path/to/file',
result: '/path/to/tofile'
}, {
name: 'path-relative path-root resolve',
url: 'tofile',
base: '/file',
result: '/tofile'
}, {
name: 'path-relative parent path resolve',
url: '../relative/path?blubber=1#hash3',
Expand Down

0 comments on commit 20d6b72

Please sign in to comment.