found problem with unit test of baseUri function, makes code much simpler

This commit is contained in:
El RIDO 2017-03-06 19:48:07 +01:00
parent fb99d5bb93
commit b6d8d0f250
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
4 changed files with 8 additions and 20 deletions

View file

@ -276,21 +276,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
return baseUri;
}
// window.baseURI isn't emulated by JSdom
var loc = window.location;
baseUri = loc.href.substring(
0,
loc.href.length - loc.search.length - loc.hash.length
);
// if base uri contains query string (when no base tag is present),
// it is unwanted
var queryIndex = baseUri.indexOf('?');
if (queryIndex !== -1) {
// so we built our own baseuri
baseUri = baseUri.substring(0, queryIndex);
}
baseUri = window.location.origin + window.location.pathname;
return baseUri;
}