diff --git a/Uri/UriFactory.js b/Uri/UriFactory.js index c4c0ba0..495547f 100644 --- a/Uri/UriFactory.js +++ b/Uri/UriFactory.js @@ -130,6 +130,8 @@ export class UriFactory const parts = url.replace(/\?/g, '&').split('&'), full = parts[0]; + // @todo: handle fragment + if (parts.length > 1) { parts.shift(); @@ -145,7 +147,7 @@ export class UriFactory let pars = []; for (const a in comps) { if (comps.hasOwnProperty(a) && comps[a] !== '' && comps[a] !== null) { - pars.push(a + '=' + encodeURIComponent(comps[a])); + pars.push(a + '=' + encodeURIComponent(comps[a]).replace(/%25/ig, '%')); } } @@ -156,6 +158,8 @@ export class UriFactory const fragments = url.match(/\#[a-zA-Z0-9\-,]+/g), fragLength = fragments !== null ? fragments.length : 0; + // @todo: don't remove fragments, some might be used = none tab fragments + for (let i = 0; i < fragLength - 1; ++i) { // remove all from old url url = url.replace(fragments[i], '');