[backend/core] Set note.text to null if it's whitespace on note creation & update

This commit is contained in:
Laura Hausmann 2024-06-04 17:51:00 +02:00
parent 28fa7eb5de
commit bcdcce80c9
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -123,7 +123,11 @@ public class NoteService(
// ReSharper restore EntityFramework.UnsupportedServerSideFunctionCall
List<MfmNode>? 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<MfmNode>? 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();