Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixing missing alias in URLs #14322
Pull Request for Issue #9698.
Summary of Changes
The modern router currently has a slightly broken behavior regarding malformed router input. If a URL given to the router does not contain a complete slug, it will either create a URL without an alias (when it is supposed to create them with IDs), or it will create a URL with a proper alias, but also with an ID, even though removing IDs is enabled. This fixes that.
Documentation Changes Required
No doc changes required.
This was referenced
Mar 4, 2017
I have tested this item
Execute the code:
And you will see the result:
@philip-sorokin I don't understand you. The URL is cached in JRouter. I don't know why the method apparently is called twice. But since this should be the exception and not the norm for a call to a component router, an additional, lightweight query doesn't seem like a problem to me.
If I add a link in an article
About caching. If I add a slightly modified link
And I am not talking about different links, but behaviour in this case the same.
The URL normally contains the slug of the article. In that case no query is run. So when you deliberately leave that of, you have to run additional queries, since we otherwise don't know how to build the URL. Yes, slightly different URLs will not hit the cache. But that is because normally those point to somewhere else. Right now this is an acceptable trade-off for me.
Normally, when you add an article link in your text editor, the link does not contain a slug, it contains only category and article IDs, and this is good, because you can change the article alias without editing this link placed in another article.
BTW, I noticed that some article links are built twice, while other only once, as expected. The link in my example is built twice.
Nothing criminal, but...