From 8914c2cf2bc202cc9e667a9a09bbaeae2afd9ccb Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 30 Jul 2020 21:26:59 +0200 Subject: [PATCH] fix bug where cached uri information were used --- Uri/UriFactory.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Uri/UriFactory.js b/Uri/UriFactory.js index 24ed70a..2585cf2 100644 --- a/Uri/UriFactory.js +++ b/Uri/UriFactory.js @@ -219,7 +219,15 @@ export class UriFactory } else if (match.indexOf('?') === 0) { return HttpUri.getUriQueryParameter(current.query, match.substr(1)); } else if (match.indexOf('#') === 0) { - return HttpUri.getFragment(); + return current.fragment; + } else if (match.indexOf('?') === 0) { + return current.query(); + } else if (match.indexOf('/') === 0) { + return current.path; + } else if (match.indexOf(':user') === 0) { + return current.user; + } else if (match.indexOf(':pass') === 0) { + return current.pass; } else if (match.indexOf('/') === 0) { return 'ERROR PATH'; } else if (match === '%') { @@ -248,15 +256,10 @@ export class UriFactory UriFactory.setQuery('/scheme', uri.getScheme()); UriFactory.setQuery('/host', uri.getHost()); UriFactory.setQuery('/base', jsOMS.rtrim(uri.getBase(), '/')); - UriFactory.setQuery('?', uri.getQuery()); - UriFactory.setQuery('%', uri.getUri()); - UriFactory.setQuery('#', uri.getFragment()); - UriFactory.setQuery('/', uri.getPath()); - UriFactory.setQuery(':user', uri.getUser()); - UriFactory.setQuery(':pass', uri.getPass()); const query = uri.getQuery(); + // @todo consider to move this to the build function like all the other components. The reason for this is that JS may change the query values on the fly on the frontend and therefore these values will not be the current values! for (const key in query) { if (query.hasOwnProperty(key)) { UriFactory.setQuery('?' + key, query[key]);