Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Bug found (and fixed?) when a site has domains and url ends in / #150

Open
OctaneAddiction opened this issue Feb 16, 2017 · 0 comments
Open

Comments

@OctaneAddiction
Copy link

Hi All;

I have found an issue in this block of code in the UrlTrackerModule.cs : UrlTrackerDo

                    if (previousFullRawUrlTest.EndsWith("/"))
                    {
                        urlTrackerDomain = domains.FirstOrDefault(x => (x.UrlWithDomain == fullRawUrlTest) || (x.UrlWithDomain == fullRawUrlTest + "/"));
                        if (urlTrackerDomain != null)
                        {
                            rootNodeId = urlTrackerDomain.NodeId;
                            urlWithoutQueryString = fullRawUrl.Replace(fullRawUrlTest, string.Empty);
                            if (urlWithoutQueryString.StartsWith("/"))
                                urlWithoutQueryString = urlWithoutQueryString.Substring(1);
                            if (urlWithoutQueryString.EndsWith("/"))
                                urlWithoutQueryString = urlWithoutQueryString.Substring(0, urlWithoutQueryString.Length - 1);
                            //To fix a situation where in using the fullRawUrlTest above appears to re-add the querystring to the urlWithoutQueryString variable
                            if (urlHasQueryString)
                                urlWithoutQueryString = url.Substring(0, url.IndexOf('?'));
                            break;
                        }
                    }

So in this function; if a url has a querystring it is removed from the url a little before this code block. However if the site then has a domain and the url ends in a / it runs into the code block above and the variable urlWithoutQueryString is filled with the fullRawUrl.Replace(fullRawUrlTest, string.Empty); which will have a querystring.

This results in urls failing to match and redirects in sites with a domain present are failing; as as the tracker is attempting to match page url's with the querystring present.

I have added a quick fix to my local code (the lines under the comment text above but haven't added it to the source. I wanted to double check with @kipusoep in any case.

Many thanks

-A

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant