? ? Pending

User tests: Successful: Unsuccessful:

avatar tonypartridge
tonypartridge
19 Sep 2017

Pull Request for Issue #17996 .

Summary of Changes

Have an absolute 404 generated i.e.

http://localhost/artriclessssss.html
find in redirect manager and redirect to:
http://localhost/articles.html

404 redirected to:

http://localhost/http://localhost/articles.html

Expected result

Redirects to
http://localhost/articles.html

To fix, install patch. Test both absolutely and relative redirects work.

Votes

# of Users Experiencing Issue
2/2
Average Importance Score
5.00

b450140 22 Aug 2017 avatar Typos
avatar joomla-cms-bot joomla-cms-bot - change - 19 Sep 2017
Category Front End Plugins
avatar tonypartridge tonypartridge - open - 19 Sep 2017
avatar tonypartridge tonypartridge - change - 19 Sep 2017
Status New Pending
avatar tonypartridge tonypartridge - change - 19 Sep 2017
Title
Staging com redirects improvements
Fix for redirect url, duplicated url in redirect. causes more 404's
avatar tonypartridge tonypartridge - edited - 19 Sep 2017
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 20 Sep 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Sep 2017

I have tested this item successfully on 3569fd6


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17997.

avatar tonypartridge
tonypartridge - comment - 20 Sep 2017

Great spot @HermanPeeren Updated now.

avatar tonypartridge tonypartridge - change - 20 Sep 2017
Labels Added: ?
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 20 Sep 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Sep 2017

I have tested this item successfully on 915e25f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17997.

avatar HermanPeeren
HermanPeeren - comment - 21 Sep 2017

If $redirect->new_url starts with 'index.php' then JUri::isInternal($redirect->new_url) is true. Line 282 then sends the $redirect->new_url through JRoute::(). No difference with what I'm suggesting, always going through JRoute::().

The redirect-plugin supports relative urls only relative to the JUri::root().

I have no example of a redirect that would go wrong if the $redirect->new_url goes trough JRoute::_(). Am I overlooking something?

avatar tonypartridge
tonypartridge - comment - 21 Sep 2017

Exactly, so if it is True we want to parse it through JRoute as it is an internal URL, rather than redirect and then parsing if it's not already parsed.

avatar HermanPeeren
HermanPeeren - comment - 21 Sep 2017

Sorry, I don't understand your latest remark, @tonypartridge.

  • I suggested the conditional in line 282 might be superfluous and we might just always go through JRoute.
  • You said it was necessary for "support relative and non-relative urls so someone could start with index.php"
  • I said that if a url starts with 'index.php' then JUri::isInternal() is true and so we go through JRoute; which is the same as I proposed (always going through JRoute).

Do you have an example of a redirect-url that would go wrong if we always go through JRoute?

avatar tonypartridge
tonypartridge - comment - 21 Sep 2017

I haven't tested or checked it enough to know, but by doing a simple check there is nothing wrong with this code. It works and doesn't pass external urls through JRoute even if JRoute supports external URLs.

avatar HermanPeeren
HermanPeeren - comment - 21 Sep 2017

That is a very practical way to look at it. I agree with you that the current code does not give a wrong result.

So please ignore my esthetical code considerations. I'll try to find time to make unit tests and refactor the code. For now the current code is useful and should be in J!3.8.1 as it repairs the 3.8.0 redirect mistake.

avatar tonypartridge
tonypartridge - comment - 21 Sep 2017

Great thanks Herman! I agree :-)

--
Tony Partridge

On 21 September 2017 at 10:47:18, HermanPeeren (notifications@github.com)
wrote:

That is a very practical way to look at it. I agree with you that the
current code does not give a wrong result.

So please ignore my esthetical code considerations. I'll try to find time
to make unit tests and refactor the code. For now the current code is
useful and should be in J!3.8.1 as it repairs the 3.8.0 redirect mistake.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#17997 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABVglkftR6PU-iAZvpsd47GwMi8lRdgDks5skjCmgaJpZM4PdIed
.

avatar tonypartridge
tonypartridge - comment - 21 Sep 2017

So your argument is to skip everything and just chuck it all through
JRoute?

--
Tony Partridge

On 21 September 2017 at 11:37:45, HermanPeeren (notifications@github.com)
wrote:

@HermanPeeren commented on this pull request.

In plugins/system/redirect/redirect.php
#17997 (comment):

@@ -279,9 +279,8 @@ private static function doErrorHandling($error)
$redirect->new_url .= '?' . $urlQuery;
}

  •                           $dest = JUri::isInternal($redirect->new_url) || strpos('http', $redirect->new_url) === false ?
    
  •                                   JRoute::_(JUri::root() . $redirect->new_url) :
    
  •                                   $redirect->new_url;
    
  •                           $dest = JUri::isInternal($redirect->new_url) || strpos($redirect->new_url, 'http') === false ?
    

@Fedik https://github.com/fedik +1
(which gives an extra argument for leaving out code that would be
superfluous, as it can introduce new errors, as demonstated here)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#17997 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABVgltRyeWPUsofDmvvtbOcpedW1TRIFks5skjx5gaJpZM4PdIed
.

avatar HermanPeeren
HermanPeeren - comment - 21 Sep 2017

Yes.
But be careful: my argument is solely based on reading the code and results should be tested thoroughly. That is why it is good to make tests before refactoring. Edge-cases like 'http' being part of the url but not on position 0 must be added to the testcases. As we have no unittests yet we should test the redirect-plugin for a variety of urls (internal, external, starting with 'index.php' or not etc.). Is it an idea to share such test-urls here?

avatar tonypartridge
tonypartridge - comment - 21 Sep 2017

@mbabker when is 3.8.1 due out? Since this is a high priority issue, we
could merge as is then run tests and refactor for 3.8.2?

Or we do it all now

--
Tony Partridge

On 21 September 2017 at 12:23:53, HermanPeeren (notifications@github.com)
wrote:

Yes.
But be careful: my argument is solely based on reading the code and results
should be tested thoroughly
. That is why it is good to make tests before
refactoring. Edge-cases like 'http' being part of the url but not on
position 0 must be added to the testcases. As we have no unittests yet we
should test the redirect-plugin for a variety of urls (internal, external,
starting with 'index.php' or not etc.). Is it an idea to share such
test-urls here?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#17997 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABVglhvA_LDFVUyCRs5dIaIjgm6C45G0ks5skkdIgaJpZM4PdIed
.

avatar HermanPeeren
HermanPeeren - comment - 21 Sep 2017

I would go for merging as is a.s.a.p. in 3.8.1, because a lot of sites have issues (like failing redirects) with 3.8.0.

The error that @Fedik came with is also not very severe, because most likely those internal-urls with 'http' on a position >0 are likely to give JUri::isInternal()== true, so won't give much practical problems.

Then we have some more time to test and refactor with 3.8.2.

avatar tonypartridge
tonypartridge - comment - 21 Sep 2017

I agree completely

--
Tony Partridge

On 21 September 2017 at 12:45:50, HermanPeeren (notifications@github.com)
wrote:

I would go for merging as is a.s.a.p. in 3.8.1, because a lot of sites
have issues (like failing redirects) with 3.8.0.

The error that @Fedik https://github.com/fedik came with is also not
very severe, because most likely those internal-urls with 'http' on a
position >0 are likely to give JUri::isInternal()== true, so won't give
much practical problems.

Then we have some more time to test and refactor with 3.8.2.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#17997 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABVgljuS_S7pDV0rPVccLxROtrolBT6eks5skkxtgaJpZM4PdIed
.

avatar Ruud68 Ruud68 - test_item - 21 Sep 2017 - Tested successfully
avatar Ruud68
Ruud68 - comment - 21 Sep 2017

I have tested this item successfully on 915e25f

Hi, just found out this issue... It is killing my #SEO as redirects don't work anymore, also all my old URLs are not accessible anymore from facebook / twitter / and the likes :(
Tested this patch successfully! Thnx Tony!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17997.

avatar franz-wohlkoenig franz-wohlkoenig - change - 21 Sep 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 21 Sep 2017

RTC after two successful tests.

avatar mbabker mbabker - change - 25 Sep 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-09-25 11:35:52
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 25 Sep 2017
avatar mbabker mbabker - merge - 25 Sep 2017

Add a Comment

Login with GitHub to post a comment