Skip to content

Commit

Permalink
Fix html encoding with brainwashing objectives in tgui (#9739)
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy authored Oct 6, 2023
1 parent cb71d77 commit f3e2b1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions tgui/packages/tgui/interfaces/AntagInfoBrainwashed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useBackend } from '../backend';
import { Icon, Section, Stack } from '../components';
import { BooleanLike } from 'common/react';
import { Window } from '../layouts';
import { sanitizeText } from '../sanitize';

type Objective = {
count: number;
Expand Down Expand Up @@ -44,7 +45,7 @@ export const AntagInfoBrainwashed = () => {
);
};

const ObjectivePrintout = (props, context) => {
const ObjectivePrintout = (_props, context) => {
const { data } = useBackend<Info>(context);
const { objectives } = data;
return (
Expand All @@ -57,7 +58,13 @@ const ObjectivePrintout = (props, context) => {
objectives.map((objective) => (
<>
<Stack.Item key={objective.count}>
{objective.count}. {objective.explanation}
{objective.count}.{' '}
<span
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: sanitizeText(objective.explanation), // brainwashing objectives are sanitized anyways
}}
/>
</Stack.Item>
<Stack.Item bold textColor="red">
This Directive must be followed.
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/common/ObjectiveSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BooleanLike } from 'common/react';
import { Box, Section, Stack } from '../../components';
import { Section, Stack } from '../../components';
import { sanitizeText } from '../../sanitize';

export type Objective = {
Expand Down

0 comments on commit f3e2b1d

Please sign in to comment.