From bcdcce80c9bc9a2af54560bb141cf5089b4370a9 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Tue, 4 Jun 2024 17:51:00 +0200 Subject: [PATCH] [backend/core] Set note.text to null if it's whitespace on note creation & update --- Iceshrimp.Backend/Core/Services/NoteService.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Iceshrimp.Backend/Core/Services/NoteService.cs b/Iceshrimp.Backend/Core/Services/NoteService.cs index f448c3c7..b183fcfd 100644 --- a/Iceshrimp.Backend/Core/Services/NoteService.cs +++ b/Iceshrimp.Backend/Core/Services/NoteService.cs @@ -123,7 +123,11 @@ public class NoteService( // ReSharper restore EntityFramework.UnsupportedServerSideFunctionCall List? nodes = null; - if (text != null) + if (text != null && string.IsNullOrWhiteSpace(text)) + { + text = null; + } + else if (text != null) { nodes = MfmParser.Parse(text).ToList(); nodes = mentionsResolver.ResolveMentions(nodes, user.Host, mentions, splitDomainMapping).ToList(); @@ -402,7 +406,11 @@ public class NoteService( List? nodes = null; - if (text != null) + if (text != null && string.IsNullOrWhiteSpace(text)) + { + text = null; + } + else if (text != null) { nodes = MfmParser.Parse(text).ToList(); nodes = mentionsResolver.ResolveMentions(nodes, note.User.Host, mentions, splitDomainMapping).ToList();