[3.7.4] Redirect bulk import allows duplicate expired URLs resulting in unexpected behaviour

Did you find a bug in Joomla! 3.x but aren't sure? This forum is the place to help figure out if the problem is a bug and how to report it. If you are an experienced Joomla! user and are certain that you have found a bug please use the Bug Tracker to submit your issue.
This forum is for discussion about bugs and to get help with reporting them to the Bug Tracker: https://issues.joomla.org

Moderator: ooffick

Forum rules
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
Locked
aj_oz
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Jul 31, 2017 6:17 am

[3.7.4] Redirect bulk import allows duplicate expired URLs resulting in unexpected behaviour

Post by aj_oz » Tue Aug 01, 2017 10:56 pm

Hi,

I have seen some behaviour with redirects that I think might be a Joomla! bug.

The issue is that when using the redirect bulk import function it is possible to import duplicate expired URLs. The duplicate URLs lead to unexpected behaviour. Specifically, a published redirect link is overridden by a redirect link in the trash.

The following steps can be used to recreate the problem with Joomla! 3.7.4 and the default sample data:

1. Enable the Redirect system plugin.
2. In the root folder, copy htaccess.txt to .htaccess.
3. Add an article with the title "Target" and the alias "target".
4. Add a menu item to the main menu with the title "Target", of single article type pointing to the "Target" article.
5. Open <base>/index.php/target, where <base> is the base URL for the site, for example http://localhost:8888. Check that the "Target" article is displayed.
6. Add a redirect link from <base>/old to <base>/index.php/wrongtarget.
7. Open <base>/old and check that it gets redirected to <base>/index.php/wrongtarget and displays a "The requested page can't be found" page.
8. Change the status of the redirect link to Trash.
9. Bulk import the following:
<base>/old|<base>/index.php/target
10. If the issue is occurring then a "1 link has been added." message will be displayed. If the issue has been fixed then an error message about the duplicate exipred URLs will be displayed.
11. Enable the new <base>/old redirect.
12. Open <base>/old. It will display a "The requested page can't be found" page.
13. Empty the trash on the Redirects:Links page (search for links with the Status Trashed, select the Check All Items checkbox in the column headings then select Empty Trash on the toolbar).
14. Open <base>/old. It will redirect to <base>/index.php/target and display the "Target" article.[/list]

In this test the trashed original link from <base>/old to <base>/index.php/wrongtarget overrides the bulk imported and published link from <base>/old to <base>/index.php/target. The code for handling the redirects seems to assume that the Expired URLs of the links will be unique. Attempting to add a link with an existing Expired URL using the New button results in a "Save failed with the following error: The source URL must be unique." error. I think that the bulk import should behave in a similar way and fail with an error message if there is a duplicate Expired URL.

Is this a Joomla! bug? Should I report it on the Bug Tracker? (When I searched the Bug Tracker I didn't find this issue.)

Thanks, Andrew

Locked

Return to “Joomla! 3.x Bug Reporting”