From c3eacb34c2a688b10b7cb40ff7d13b9f62fa46f2 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Wed, 14 Aug 2024 01:37:25 +0200 Subject: [PATCH] [backend/federation] Add support for hubzilla's hashtag formatting A bit strange but here we are --- Iceshrimp.Backend/Core/Services/NoteService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Iceshrimp.Backend/Core/Services/NoteService.cs b/Iceshrimp.Backend/Core/Services/NoteService.cs index 6f8dffab..36f1c5f4 100644 --- a/Iceshrimp.Backend/Core/Services/NoteService.cs +++ b/Iceshrimp.Backend/Core/Services/NoteService.cs @@ -157,7 +157,8 @@ public class NoteService( // @formatter:off var match = asNote.Tags?.OfType().Where(p => p.Name != null && p.Href != null) ?? []; //TODO: refactor this to use the nodes object instead of matching on text - text = match.Aggregate(text, (current, tag) => current.Replace($"[#{tag.Name!.TrimStart('#')}]({tag.Href})", $"#{tag.Name!.TrimStart('#')}")); + text = match.Aggregate(text, (current, tag) => current.Replace($"[#{tag.Name!.TrimStart('#')}]({tag.Href})", $"#{tag.Name!.TrimStart('#')}") + .Replace($"#[{tag.Name!.TrimStart('#')}]({tag.Href})", $"#{tag.Name!.TrimStart('#')}")); // @formatter:on }