No Code Attached Yet bug
avatar robbiejackson
robbiejackson
12 Dec 2022

Steps to reproduce the issue

Ensure that Enable Versions is Yes for articles.
Save a number of versions of the same com_content category.
Then when editing the category, click on the Versions button.
Within the modal window select an older version of the category and click on the Restore button.

Expected result

The previous version should be shown in the category edit form.

Actual result

Error 404 is returned.
The traceback shows

Call stack

| Function | Location

1 | () | JROOT\libraries\src\Component\ComponentHelper.php:351
2 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT\libraries\src\Application\AdministratorApplication.php:143
3 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT\libraries\src\Application\AdministratorApplication.php:186
4 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT\libraries\src\Application\CMSApplication.php:294
5 | Joomla\CMS\Application\CMSApplication->execute() | JROOT\administrator\includes\app.php:61
6 | require_once() | JROOT\administrator\index.php:32

System information (as much as possible)

Joomla 4.2.5 on Windows 10

Additional comments

Whenever the Restore button is clicked it generates a GET to a URL of the form:

http://localhost/j4hw/administrator/index.php?option=com_categoriesampextensioncom_content&task=category.loadhistory&fc703ee9b61e0e019f126ea5e8460952=1&version_id=29

This fails in ComponentHelper because it takes the option as com_categoriesampextensioncom_content and can't find a component of that name.

I think that the problem is in administrator\components\com_contenthistory\src\View\History\HtmlView.php::addToolbar

The code

$option = $aliasArray[1] == 'category'
        ? 'com_categories&extension=' . implode('.', array_slice($aliasArray, 0, count($aliasArray) - 2))
        : $aliasArray[0];

sets the $option to com_categories&extension=com_content

Then the line:

$loadUrl    = Route::_('index.php?option=' . $filter->clean($option, 'cmd') . '&task=' . $task . '&' . $token . '=1');

results in

$filter->clean($option, 'cmd')

removing the non-alpha characters from the $option to leave com_categoriesampextensioncom_content, which then gets incorporated into the url.

avatar robbiejackson robbiejackson - open - 12 Dec 2022
avatar joomla-cms-bot joomla-cms-bot - change - 12 Dec 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Dec 2022
avatar brianteeman
brianteeman - comment - 12 Dec 2022

Bug confirmed

avatar Quy Quy - change - 12 Dec 2022
Labels Added: bug
avatar Quy Quy - labeled - 12 Dec 2022
avatar joomdonation joomdonation - close - 22 Dec 2022
avatar joomdonation
joomdonation - comment - 22 Dec 2022

PR #39474 should solve the issue. Please help testing. Thanks !

avatar joomdonation joomdonation - change - 22 Dec 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-12-22 14:52:21
Closed_By joomdonation

Add a Comment

Login with GitHub to post a comment