Escape paper input (#12863)

This commit is contained in:
Leon Friedrich 2022-12-04 22:32:44 +13:00 committed by GitHub
parent afbb3f28f0
commit f99f681815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,7 @@ using Content.Shared.Paper;
using Content.Shared.Tag;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using static Content.Shared.Paper.SharedPaperComponent;
namespace Content.Server.Paper
@ -105,8 +106,10 @@ namespace Content.Server.Paper
if (string.IsNullOrEmpty(args.Text))
return;
if (args.Text.Length + paperComp.Content.Length <= paperComp.ContentSize)
paperComp.Content += args.Text + '\n';
var text = FormattedMessage.EscapeText(args.Text);
if (text.Length + paperComp.Content.Length <= paperComp.ContentSize)
paperComp.Content += text + '\n';
if (TryComp<AppearanceComponent>(uid, out var appearance))
appearance.SetData(PaperVisuals.Status, PaperStatus.Written);