Skip to content

Commit

Permalink
Work around path issue with URI.js (medialize/URI.js#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Burgmer committed Jun 19, 2012
1 parent 745f431 commit 219dc1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rasterizeHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var rasterizeHTML = (function () {

module.util.joinUrl = function (baseUrl, url) {
var theUrl = new URI(url);
if (theUrl.is("relative")) {
if (theUrl.is("relative") && baseUrl.indexOf("/") >= 0) {
theUrl = theUrl.absoluteTo(baseUrl);
}
return theUrl.toString();
Expand Down
5 changes: 5 additions & 0 deletions test/UtilSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ describe("Utilities", function () {
var url = rasterizeHTML.util.joinUrl("http://example.com/rel/path/", "http://github.com//the_relative_url");
expect(url).toEqual("http://github.com//the_relative_url")
});

it("should ignore base without directories", function () {
var url = rasterizeHTML.util.joinUrl("aFile", "anotherFile");
expect(url).toEqual("anotherFile");
});
});

describe("Data URI handling", function () {
Expand Down

0 comments on commit 219dc1c

Please sign in to comment.