Commit 6e3ec7eb authored by Jochen Roth's avatar Jochen Roth Committed by Christian Kuhn
Browse files

[BUGFIX] Enforce setCopyMode in clipboard

The clipboard component features helper methods,
which generate a URL to update the clipboard
state with new elements. Those are used in
recordlist and filelist.

Previously the "setCopyMode" parameter was
only set in case the element should be "copied".
This then might lead to no "mode" set in the
clipboardData at all. Like other modules
already do, the helper methods do now always
set the "setCopyMode" parameter to enforce
the generation of the "mode" key in the
clipboardData.

Anyways, an access of the "mode" in the page
module is secured by a null collapse operator.

Resolves: #95536
Releases: master
Change-Id: I0799f711cd3ab8b6be702b62ba26d974d46da2d0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71504

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Nikita Hovratov's avatarNikita Hovratov <nikita.h@live.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 2e1d68b9
......@@ -515,11 +515,12 @@ class Clipboard
*/
public function selUrlDB(string $table, int $uid, bool $copy = false, bool $deselect = false): string
{
$CB = ['el' => [$table . '|' . $uid => $deselect ? 0 : 1]];
if ($copy) {
$CB['setCopyMode'] = 1;
}
return $this->buildUrl(['CB' => $CB]);
return $this->buildUrl(['CB' => [
'el' => [
$table . '|' . $uid => $deselect ? 0 : 1,
],
'setCopyMode' => (int)$copy,
]]);
}
/**
......@@ -532,15 +533,12 @@ class Clipboard
*/
public function selUrlFile(string $path, bool $copy = false, bool $deselect = false): string
{
$CB = [
return $this->buildUrl(['CB' => [
'el' => [
'_FILE|' . md5($path) => $deselect ? '' : $path,
],
];
if ($copy) {
$CB['setCopyMode'] = 1;
}
return $this->buildUrl(['CB' => $CB]);
'setCopyMode' => (int)$copy,
]]);
}
/**
......
......@@ -645,7 +645,7 @@ class PageLayoutController
function(Paste) {
Paste.itemOnClipboardUid = ' . $pasteItem . ';
Paste.itemOnClipboardTitle = ' . GeneralUtility::quoteJSvalue($pasteTitle) . ';
Paste.copyMode = ' . GeneralUtility::quoteJSvalue($clipboard->clipData['normal']['mode']) . ';
Paste.copyMode = ' . GeneralUtility::quoteJSvalue($clipboard->clipData['normal']['mode'] ?? '') . ';
}');
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment