Strip markdown formatting from changelog in update dialog

The confirm dialog is plain text and cannot render markdown. Strip
headings, bold, italic, code backticks, and normalize list bullets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-05 02:37:18 +01:00
parent 6db03f05a9
commit 56ee681aec
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "real-debrid-downloader", "name": "real-debrid-downloader",
"version": "1.6.38", "version": "1.6.39",
"description": "Desktop downloader", "description": "Desktop downloader",
"main": "build/main/main/main.js", "main": "build/main/main/main.js",
"author": "Sucukdeluxe", "author": "Sucukdeluxe",

View File

@ -1001,7 +1001,16 @@ export function App(): ReactElement {
} }
let changelogBlock = ""; let changelogBlock = "";
if (result.releaseNotes) { if (result.releaseNotes) {
const notes = result.releaseNotes.length > 500 ? `${result.releaseNotes.slice(0, 500)}` : result.releaseNotes; // Strip markdown formatting for plain-text confirm dialog
let notes = result.releaseNotes
.replace(/^#{1,6}\s+/gm, "") // ## headings
.replace(/\*\*([^*]+)\*\*/g, "$1") // **bold**
.replace(/\*([^*]+)\*/g, "$1") // *italic*
.replace(/`([^`]+)`/g, "$1") // `code`
.replace(/^\s*[-*]\s+/gm, "- ") // normalize list bullets
.replace(/\n{3,}/g, "\n\n") // collapse excess blank lines
.trim();
if (notes.length > 500) notes = `${notes.slice(0, 500)}`;
changelogBlock = `\n\n--- Changelog ---\n${notes}`; changelogBlock = `\n\n--- Changelog ---\n${notes}`;
} }
const approved = await askConfirmPrompt({ const approved = await askConfirmPrompt({