From faaab898a8f1b6f7f84d4f6ce0081110ac784ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Mon, 15 Apr 2024 15:19:56 +0200 Subject: [PATCH] Avoid using dangerouslySetInnerHTML - invalid translation can break the markup - it is insecure --- .../storage/DeviceSelectionDialog.jsx | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/web/src/components/storage/DeviceSelectionDialog.jsx b/web/src/components/storage/DeviceSelectionDialog.jsx index 1095b63963..09aa98fcd1 100644 --- a/web/src/components/storage/DeviceSelectionDialog.jsx +++ b/web/src/components/storage/DeviceSelectionDialog.jsx @@ -42,10 +42,6 @@ const SELECT_DISK_PANEL_ID = "panel-for-disk-selection"; const CREATE_LVM_PANEL_ID = "panel-for-lvm-creation"; const OPTIONS_NAME = "selection-mode"; -const Html = ({ children, ...props }) => ( -
-); - /** * Renders a dialog that allows the user to select a target device for installation. * @component @@ -101,6 +97,19 @@ export default function DeviceSelectionDialog({ const isDeviceSelectable = (device) => device.isDrive || device.type === "md"; + // TRANSLATORS: description for using plain partitions for installing the + // system, the text in the square brackets [] is displayed in bold, use only + // one pair in the translation + const [msgStart1, msgBold1, msgEnd1] = _("The file systems will be allocated \ +by default as [new partitions in the selected device].").split(/[[\]]/); + // TRANSLATORS: description for using logical volumes for installing the + // system, the text in the square brackets [] is displayed in bold, use only + // one pair in the translation + const [msgStart2, msgBold2, msgEnd2] = _("The file systems will be allocated \ +by default as [logical volumes of a new LVM Volume Group]. The corresponding \ +physical volumes will be created on demand as new partitions at the selected \ +devices.").split(/[[\]]/); + return ( - - { - // TRANSLATORS: beware the HTML markup ( and ) - _("The file systems will be allocated by default as new partitions in the selected device.") - } - + {msgStart1} + {msgBold1} + {msgEnd1} - - { - // TRANSLATORS: beware the HTML markup ( and ) - _("The file systems will be allocated by default as logical volumes of a new LVM Volume \ -Group. The corresponding physical volumes will be created on demand as new partitions at the selected devices.") - } - + {msgStart2} + {msgBold2} + {msgEnd2}