? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
19 Feb 2018

Pull Request for Issue #19713

Summary of Changes

When checking old_urls for duplicates, com_redirect does not make the difference between utf8 and ascii characters. By rawurlencode them, it solves the issue.

Testing Instructions

See #19713

an old url of type http://mydomain.com/bogusurl will not be considered as different from http://mydomain.com/bøgusurl and therefore com_redirect considers it as duplicate.

After patch it does not any more and each can get a different new URL

screen shot 2018-02-19 at 10 06 56

Votes

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

avatar infograf768 infograf768 - open - 19 Feb 2018
avatar infograf768 infograf768 - change - 19 Feb 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Feb 2018
Category Administration com_redirect
avatar bubi-luka
bubi-luka - comment - 19 Feb 2018

Tested and it resolves the issue I was having! Thank you for the patch!

avatar infograf768
infograf768 - comment - 19 Feb 2018
avatar bubi-luka
bubi-luka - comment - 19 Feb 2018

I have tested this item successfully on e07c7b1

Tested OK.


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

avatar bubi-luka bubi-luka - test_item - 19 Feb 2018 - Tested successfully
avatar chmst
chmst - comment - 21 Feb 2018

I have tested this item successfully on e07c7b1

I've tested this item successfully


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

avatar chmst chmst - test_item - 21 Feb 2018 - Tested successfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 21 Feb 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 21 Feb 2018

Ready to Commit after two successful tests.

avatar infograf768
infograf768 - comment - 21 Feb 2018

Thanks for testing.

avatar HLeithner
HLeithner - comment - 22 Feb 2018

@infograf768 are you sure that this works as expected? I only did a code review and for me it looks like that automatically added urls in the plugin aren't rawurlencode.

$url = StringHelper::strtolower(rawurldecode($uri->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'))));

It maybe works because the plugin database query is really strange and fault tolerant.

$query->select('*')
->from($db->quoteName('#__redirect_links'))
->where(
'('
. $db->quoteName('old_url') . ' = ' . $db->quote($url)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($urlRel)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($urlRootRel)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($urlRootRelSlash)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($urlWithoutQuery)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($urlRelWithoutQuery)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurl)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlRel)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlRootRel)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlRootRelSlash)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlWithoutQuery)
. ' OR '
. $db->quoteName('old_url') . ' = ' . $db->quote($orgurlRelWithoutQuery)
. ')'
);

Also in the same function the old_url get rawurldecoded before it get saved. So future check calls wouldn't find the current saved old_url.

$this->old_url = trim(rawurldecode($this->old_url));

avatar infograf768
infograf768 - comment - 22 Feb 2018

Yes, I am sure it works.
bogus urls should be entered in frontend (backend accepts anything when creating a new old url and this PR does not correct it.)

What is done in this PR is just check for duplicates. It does not change the old_url as present in the db. That old_url has been saved in db as pure utf8.
By rawurlencoding them when checking for duplicates, we really differentiate them.

I suggest you just test with the bogus urls in the test instructions, or any other bogus urls, one with accent and another without.

avatar mbabker mbabker - change - 26 Feb 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-02-26 03:10:41
Closed_By mbabker
Labels Added: ? ?
avatar mbabker mbabker - close - 26 Feb 2018
avatar mbabker mbabker - merge - 26 Feb 2018

Add a Comment

Login with GitHub to post a comment