Issue Bug Closed

#105197ElementInformationController preview url uses wrong language

Filipe DA COSTA 10/04/24, 12:59 updated 12/02/25, 14:32

Description

In the Filelist when looking at file information, we list the records linked to a specific file in the “References to this item” section.
For page records we have the “View webpage” action that loads the page in a new window.

If the page is a translation, the generated URL on that action is wrong. It should be “ domain.tdl/de/german-page “ but instead it tries to open “ domain.tdl/fr/german-page “ (fr is default langage)
In other parts of the backend the URL resolving works correctly, it’s only in Filelist.

Main issue seems be in ElementInformationController.php#L494 where we don’t pass the record language to PreviewUriBuilder:

            $previewUriBuilder = PreviewUriBuilder::create((int)$uid)
                ->withRootLine(BackendUtility::BEgetRootLine($uid));

I’ve tested by retrieving the record and pass the language and it works:

$record = BackendUtility::getRecord($table, $uid);
$previewUriBuilder = PreviewUriBuilder::create((int)$uid)
->withLanguage($record['sys_language_uid'])
->withRootLine(BackendUtility::BEgetRootLine($uid));

But to avoid all those queries, we could change ElementInformationController::getRecordActions() to pass the $row[‘sys_language_uid’] that we already have in ElementInformationController::makeRef()/makeRefFrom()

Reviews 3

History 413

  1. Garvin Hicking commented and changed category status New Needs Feedback <span data-processor="relativetime" data-value="2024-10-04T19:03:15+00:00" > 10/04/24, 19:03 </span>

    Would you like to contribute this as a patch maybe? Your code above looks like a approach proper to me. Thanks for helping!

  2. Filipe DA COSTA commented <span data-processor="relativetime" data-value="2024-10-07T07:20:46+00:00" > 10/07/24, 07:20 </span>

    Garvin Hicking wrote in #note-1:
    > Would you like to contribute this as a patch maybe? Your code above looks like a approach proper to me. Thanks for helping!

    Yes, will do

  3. Gerrit Code Review pushed patch set 1 for main to change 86447 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2024-10-07T13:04:52+00:00" > 10/07/24, 13:04 </span>

  4. Filipe DA COSTA commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2024-11-18T10:15:10+00:00" > 11/18/24, 10:15 </span>

    Applied in changeset commit:f25496504a2d714f994a602fe43160d2dcabf7d9.