From 26751f220762bac08f5b06f015a03be7f55cc108 Mon Sep 17 00:00:00 2001 From: llama Date: Tue, 16 Dec 2025 00:09:51 +0800 Subject: [PATCH 1/3] fix(io): remove incorrect error toast shown when saving twice (#4458) --- .../add-or-update-note.svelte.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/ts/routes/image-occlusion/add-or-update-note.svelte.ts b/ts/routes/image-occlusion/add-or-update-note.svelte.ts index ce31eaaaf..8494563b4 100644 --- a/ts/routes/image-occlusion/add-or-update-note.svelte.ts +++ b/ts/routes/image-occlusion/add-or-update-note.svelte.ts @@ -37,7 +37,9 @@ export const addOrUpdateNote = async function( backExtra, tags, }); - showResult(mode.noteId, result, noteCount); + if (result.note) { + showResult(mode.noteId, result, noteCount); + } } else { const result = await addImageOcclusionNote({ // IOCloningMode is not used on mobile @@ -55,23 +57,12 @@ export const addOrUpdateNote = async function( // show toast message const showResult = (noteId: number | null, result: OpChanges, count: number) => { const props = $state({ - message: "", - type: "error" as "error" | "success", + message: noteId ? tr.browsingCardsUpdated({ count: count }) : tr.importingCardsAdded({ count: count }), + type: "success" as "error" | "success", showToast: true, }); mount(Toast, { target: document.body, props, }); - - if (result.note) { - const msg = noteId ? tr.browsingCardsUpdated({ count: count }) : tr.importingCardsAdded({ count: count }); - props.message = msg; - props.type = "success"; - props.showToast = true; - } else { - const msg = tr.notetypesErrorGeneratingCloze(); - props.message = msg; - props.showToast = true; - } }; From cb7a8dbc1022167f04be7d1669bfcfbee86d5019 Mon Sep 17 00:00:00 2001 From: llama Date: Wed, 17 Dec 2025 00:22:18 +0800 Subject: [PATCH 2/3] fix(ci): bump cargo-deny to 0.18.6 (#4447) --- tools/minilints/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/minilints/src/main.rs b/tools/minilints/src/main.rs index 6d38278b5..ca645efe6 100644 --- a/tools/minilints/src/main.rs +++ b/tools/minilints/src/main.rs @@ -202,7 +202,7 @@ fn sveltekit_temp_file(path: &str) -> bool { } fn check_cargo_deny() -> Result<()> { - Command::run("cargo install cargo-deny@0.18.3")?; + Command::run("cargo install cargo-deny@0.18.6")?; Command::run("cargo deny check")?; Ok(()) } From 4e8c992be1b7d628ba4168a54355fedb0b0e6804 Mon Sep 17 00:00:00 2001 From: Lee Doughty <32392044+leedoughty@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:23:40 +0000 Subject: [PATCH 3/3] fix: prevent
from appearing as text in error message (#4451) * Update error text format to use RichText rather than PlainText * Set CardTypeError messages as rich text to allow HTML formatting * Use CardTypeError from anki.errors module --- qt/aqt/errors.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/qt/aqt/errors.py b/qt/aqt/errors.py index a6d9251e2..89e15246e 100644 --- a/qt/aqt/errors.py +++ b/qt/aqt/errors.py @@ -14,7 +14,7 @@ from markdown import markdown import aqt from anki.collection import HelpPage -from anki.errors import BackendError, Interrupted +from anki.errors import BackendError, CardTypeError, Interrupted from anki.utils import is_win from aqt.addons import AddonManager, AddonMeta from aqt.qt import * @@ -36,6 +36,14 @@ def show_exception(*, parent: QWidget, exception: Exception) -> None: global _mbox error_lines = [] help_page = HelpPage.TROUBLESHOOTING + + # default to PlainText + text_format = Qt.TextFormat.PlainText + + # set CardTypeError messages as rich text to allow HTML formatting + if isinstance(exception, CardTypeError): + text_format = Qt.TextFormat.RichText + if isinstance(exception, BackendError): if exception.context: error_lines.append(exception.context) @@ -51,7 +59,7 @@ def show_exception(*, parent: QWidget, exception: Exception) -> None: ) error_text = "\n".join(error_lines) print(error_lines) - _mbox = _init_message_box(str(exception), error_text, help_page) + _mbox = _init_message_box(str(exception), error_text, help_page, text_format) _mbox.show() @@ -171,7 +179,10 @@ if not os.environ.get("DEBUG"): def _init_message_box( - user_text: str, debug_text: str, help_page=HelpPage.TROUBLESHOOTING + user_text: str, + debug_text: str, + help_page=HelpPage.TROUBLESHOOTING, + text_format=Qt.TextFormat.PlainText, ): global _mbox @@ -179,7 +190,7 @@ def _init_message_box( _mbox.setWindowTitle("Anki") _mbox.setText(user_text) _mbox.setIcon(QMessageBox.Icon.Warning) - _mbox.setTextFormat(Qt.TextFormat.PlainText) + _mbox.setTextFormat(text_format) def show_help(): openHelp(help_page)