We have moved to GitHub Issues
Created by Simon Dingley 18 Jan 2017, 11:10:46 Updated by Sebastiaan Janssen 31 Oct 2017, 22:22:35Tags: Backport Unscheduled PR
We have a large load balanced install hosting multiple sites and it periodically has a problem whereby some links are generated with a double slash at the start of the path to the document. It doesn't affect all urls and it is usually rectified by publishing the document. The problem is that
.Url property on the front end results in broken links as a result.
Relevant appsettings from the web.config in case they are of use:
Relevant settings from umbracoSettings.config:
I can't as yet find a way to force this to happen so it's a bit hard to replicate.
Do you have any custom URL Providers? We had this problem on a load balanced site we inherited, and that's caused by an issue with one of the URL providers.
Yes, there is one custom url provider
DateFolderUrlProvider which formats news/blog/press items to have the dates in the urls. I'll look at that but I wonder why it is intermittent - I'd expect it to be consistent.
I looked further at this and the doctypes affected by this issue are not using the Url Provider and so that seems unrelated to the issue. Furthermore, this morning when the issue returned and I looked at the node url on the properties tab there were 3 forward slashes e.g. https://example.com///path/to/document/
I have the same issue and have attached a screenshot where the
Link to Document is displaying incorrectly too.
umbraco.config as above.
Umbraco version 7.5.3
I'm seeing the same with a particular node on a site, and at first thought it was using an IUrlProvider, but it's not (although we do have an IContentFinder for it, instead of a url rewrite).
However, we're not using domain prefixes;
<add key="umbracoHideTopLevelNodeFromPath" value="true" /> <add key="umbracoUseDirectoryUrls" value="true" />
It happens at random, generating the url as
//blog, until you manually hit
/blog, at which point it reverts for a while to working OK.
This has happened to me with extra trailing slashes. It happens any time I use the method
UmbracoContext.Current.ContentCache.GetByRoute() Basically, I had to remove all calls of that function and republish the site to fix things.
That's interesting! Are you saying that's what triggers the problem or the content item you get back from a call to GetByRoute() has a url that contains a double slash? IN fact, I think this rings true perhaps with what @AttackMonkey said above about it being triggered by a UrlProvider or more likely the corresponding ContentFinder which very likely makes a call to
We don't look after the site this was on any more, but looking through the old source code, there are calls to that method in a custom content finder.......
In my experimentation, any direct calls to
UmbracoContext.Current.ContentCache.GetByRoute(), whether it's from a custom content finder or not, will for some reason yield this issue. You'd think the method is purely read-only and would not affect the
.Url property of an IPublishedContent object, but it does. Even when you view the Properties tab, the "Link to document" field will look like this for me:
/hello/// Very strange indeed.
Hmm, this looks like a problem with trailing slashes which I see less often, the issue we keep experiencing is the leading slashes. At least now I think we've identified a part of the Umbraco source to start looking at.
@ProNotion We are seeing this same issue on our website and oddly enough we are using the same call mentioned above:
Is anyone at @devteam looking into this issue? It's very strange that something is affected by calling what we assume is a read-only function.
@firstname.lastname@example.org and all: It might help to check the "Affected versions" on the right if you're using the latest version of Umbraco and still have the issue, and vote if you haven't already.
Good point @oooshola. I have updated it with the version I am using and still seeing the issue. The only way I know to resolve it for a node with this issue is to republish the node in the umbraco back office.
Does anyone have any work arounds to resolve this issue? Thankfully our site is not live yet but for demos with the client it is a pain to check all the Urls, etc.
Pretty much ruined my day so far but I think I have finally found the issue and have submitted a [pull request|https://github.com/umbraco/Umbraco-CMS/pull/2266]. In the
UriUtility class there is a method called [UriToUmbraco|https://github.com/umbraco/Umbraco-CMS/blob/dev-v7.6/src/Umbraco.Web/UriUtility.cs#L73] where if the
AddTrailingSlash option is enabled in your config it will basically append a forward slash without first checking if there is already a trailing slash.
That was tough (for me anyway) to track this down as it was not easy to step through and find where it was occurring.
Great sleuth work! much appreciated :) will merge the PR asap
@Shandem any chance we can get a patch for 7.6.* version of umbraco for those of us that aren't ready to upgrade to 7.7.* due to all the user changes?
Yes I've added the back port tag so when we release another 7.6 we can include it
Also fixed for 7.6.12 - https://github.com/umbraco/Umbraco-CMS/commit/84b380028c929c6deac80ccaf75566c99740ac7c
Backwards Compatible: True
Fix Submitted: Pull request
Affected versions: 7.5.3, 7.6.4
Due in version: 7.7.5, 7.6.12