From daec18546c4b15aa3684d00a11feb8d26e4bb9b6 Mon Sep 17 00:00:00 2001 From: Sulthan Zaki Date: Sat, 25 Jul 2026 23:19:16 +0700 Subject: [PATCH] fix(backend): valid hx-target selector and reject NaN/Infinity chapter input hx-target="#card-" is an invalid CSS selector for any key containing a colon (every real bookmark key is ":"), so htmx threw before swapping and the favourite/delete/chapter-override controls were dead in the browser. Switch to the attribute-selector form [id='card-'], which querySelectorAll accepts regardless of the id's characters. Also close a validation gap in uiChapter: strconv.ParseFloat accepts "NaN"/"Infinity"/"-Inf" with err == nil, and every comparison against NaN is false, so num < 0 let both through to last_chapter_num and permanently broke HasNewChapter. Reject non-finite values explicitly. Co-Authored-By: Claude Opus 5 --- backend/templates/card.html | 6 +++--- backend/web.go | 3 ++- backend/web_test.go | 38 ++++++++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/backend/templates/card.html b/backend/templates/card.html index ea23820..a7e19ef 100644 --- a/backend/templates/card.html +++ b/backend/templates/card.html @@ -15,19 +15,19 @@