Issue Bug Closed

#109266Fileadmin context menu (Cut, Copy) not working

Michal Podrouzek 03/16/26, 21:38 updated 04/21/26, 11:30

Description

In the context menu (right click on file) in fileadmin list view in clean instance of TYPO3 14 user cannot copy or cut content. I’ve compared it with the version 13 where it works fine.

In the ContextMenuController the $CB is retrieved, but since it is urlencoded, it does not work in the clipboard. I’ve managed to get it working with patching ContextMenuController::clipboardAction to decode the file before passing the $CB to clipboard.

public function clipboardAction(ServerRequestInterface $request): ResponseInterface
    {
        $clipboard = GeneralUtility::makeInstance(Clipboard::class);
        $clipboard->initializeClipboard($request);
        $clipboard->lockToNormal();

        $CB = array_replace_recursive($request->getQueryParams()['CB'] ?? [], $request->getParsedBody()['CB'] ?? []);
        // FIX: Decode the keys in the 'el' array
        if (isset($CB['el']) && is_array($CB['el'])) {
            $decodedEl = [];
            foreach ($CB['el'] as $key => $value) {
                $decodedEl[urldecode($key)] = $value;
            }
            $CB['el'] = $decodedEl;
        }
        $clipboard->setCmd($CB);
        $clipboard->cleanCurrent();

        $clipboard->endClipboard();
        return new JsonResponse([]);
    }

Reviews 1