From fa947c82ede0b613d358446d2deed435c83c85ae Mon Sep 17 00:00:00 2001 From: Meleki Date: Mon, 9 Mar 2026 18:53:25 +0100 Subject: [PATCH] fix: Todo-Liste parst nur letzte ID korrekt (\r\n-Problem) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend: sb.AppendLine() durch sb.Append()+\n ersetzt für konsistente Zeilenenden auf allen Plattformen. Frontend: \r defensiv entfernen vor Regex-Matching, da JS-Regex (.+)$ kein \r matcht und nur letzte Zeile geparsed wurde. --- Services/ToolService.cs | 2 +- wwwroot/js/tool-ui.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Services/ToolService.cs b/Services/ToolService.cs index 87cb068..136e4c5 100644 --- a/Services/ToolService.cs +++ b/Services/ToolService.cs @@ -562,7 +562,7 @@ public class ToolService var priority = todo.TryGetProperty("priority", out var prio) ? prio.GetString() : null; var icon = status switch { "completed" => "✅", "in_progress" => "🔄", _ => "⬜" }; var prioTag = priority != null ? $" [{priority}]" : ""; - sb.AppendLine($"{icon} [{id}]{prioTag} {content}"); + sb.Append($"{icon} [{id}]{prioTag} {content}\n"); } return sb.Length == 0 ? "(leere Todo-Liste)" : sb.ToString().TrimEnd(); } diff --git a/wwwroot/js/tool-ui.js b/wwwroot/js/tool-ui.js index da42dbf..c12b945 100644 --- a/wwwroot/js/tool-ui.js +++ b/wwwroot/js/tool-ui.js @@ -197,7 +197,7 @@ function buildTodoList(result, isError) { const container = document.createElement('div'); container.className = 'todo-list' + (isError ? ' tool-error' : ''); - const lines = result.split('\n').filter(l => l.trim()); + const lines = result.split('\n').map(l => l.replace(/\r$/, '')).filter(l => l.trim()); for (const line of lines) { // Format: ICON [id] [priority] content const m = line.match(/^(\S+)\s+\[([^\]]+)\]\s+(?:\[([^\]]+)\]\s+)?(.+)$/);