fixed path normalization for paths relative to root
This commit is contained in:
parent
5e9f0b077e
commit
5bfe563305
1 changed files with 6 additions and 2 deletions
|
|
@ -103,8 +103,12 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.$normalizePath = function(path) {
|
||||
if (!path.match(/^\w+:/))
|
||||
path = location.protocol + "//" + location.host + location.pathname.replace(/\/[^\/]*$/, "") + "/" + path.replace(/^\//, "");
|
||||
if (!path.match(/^\w+:/)) {
|
||||
path = location.protocol + "//" + location.host
|
||||
// paths starting with a slash are relative to the root (host)
|
||||
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
|
||||
+ "/" + path.replace(/^[\/]+/, "");
|
||||
}
|
||||
return path;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue