Skip to content

Commit

Permalink
Issue kipusoep#177 Further fix to esure the path starts with a forwar…
Browse files Browse the repository at this point in the history
…d slash or it breaks urls
  • Loading branch information
ProNotion committed Jun 6, 2018
1 parent c5289ec commit c43ae98
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Modules/UrlTrackerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void UrlTrackerDo(string callingEventName, bool ignoreHttpStatusCode = fa
string fullRawUrl;
string previousFullRawUrlTest;
string fullRawUrlTest;
fullRawUrl = previousFullRawUrlTest = fullRawUrlTest = string.Format("{0}{1}{2}{3}", request.Url.Scheme, Uri.SchemeDelimiter, request.Url.Host, request.Url.AbsolutePath);
fullRawUrl = previousFullRawUrlTest = fullRawUrlTest = string.Format("{0}{1}{2}{3}", request.Url.Scheme, Uri.SchemeDelimiter, request.IsLocal ? request.Url.Authority : request.Url.Host, request.Url.AbsolutePath);

UrlTrackerDomain urlTrackerDomain;
do
Expand Down Expand Up @@ -356,12 +356,12 @@ static void UrlTrackerDo(string callingEventName, bool ignoreHttpStatusCode = fa
string pathAndQuery = Uri.UnescapeDataString(redirectUri.PathAndQuery.EnsureStartsWith("/")) + redirectUri.Fragment;
// Determine if we need to include the port number
string port = redirectUri.Port != 80 && UrlTrackerSettings.AppendPortNumber ? string.Concat(":", redirectUri.Port) : string.Empty;
// Extract the Uri path wihtout any querystring
// Extract the Uri path without any querystring
string path = pathAndQuery.Contains('?') ? pathAndQuery.Substring(0, pathAndQuery.IndexOf('?')) : pathAndQuery.StartsWith("/") ? pathAndQuery.Substring(1) : pathAndQuery;
// Assemble the new querystring but only if there are key/values to pass through
string querystring = newQueryString.HasKeys() ? string.Concat("?", newQueryString.ToQueryString()) : string.Empty;

redirectUri = new Uri(string.Format("{0}{1}{2}{3}{4}{5}", redirectUri.Scheme, Uri.SchemeDelimiter, redirectUri.Host, port, path, querystring));
redirectUri = new Uri(string.Format("{0}{1}{2}{3}{4}{5}", redirectUri.Scheme, Uri.SchemeDelimiter, redirectUri.Host, port, path.EnsureStartsWith("/"), querystring));
}

if (redirectUri == new Uri(string.Format("{0}{1}{2}{3}/{4}", request.Url.Scheme, Uri.SchemeDelimiter, request.Url.Host, request.Url.Port != 80 && UrlTrackerSettings.AppendPortNumber ? string.Concat(":", request.Url.Port) : string.Empty, request.RawUrl.StartsWith("/") ? request.RawUrl.Substring(1) : request.RawUrl)))
Expand Down

0 comments on commit c43ae98

Please sign in to comment.