Closes: #1077671
---
Hi! Here is a patch fixing this bug. You can apply this with `git am`.

Bye :)

 debian/patches/series                     |  1 +
 debian/patches/string-before-concat.patch | 25 +++++++++++++++++++++++
 debian/tests/pkgreport.html.supposed      |  8 ++++----
 3 files changed, 30 insertions(+), 4 deletions(-)
 create mode 100644 debian/patches/series
 create mode 100644 debian/patches/string-before-concat.patch

diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d5395da
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+string-before-concat.patch
diff --git a/debian/patches/string-before-concat.patch 
b/debian/patches/string-before-concat.patch
new file mode 100644
index 0000000..b4b6e74
--- /dev/null
+++ b/debian/patches/string-before-concat.patch
@@ -0,0 +1,25 @@
+Description: format(input): convert to string before concat
+ The checked character for `<input type="checkbox">` was concatenated to
+ the '[' and ']' characters before converting it to string, which
+ resulted in an expression like '[' + 'X' + ']', which results in an
+ arithmetic sum between the integer values of the three characters,
+ leading to an unexpected result.
+ .
+ To fix this, simply wrap the checked ternary expression with a braced
+ string constructor.
+Author: Andrea Pappacoda <and...@pappacoda.it>
+Bug-Debian: https://bugs.debian.org/1077671
+Forwarded: https://gitlab.com/grobian/html2text/-/merge_requests/54
+Last-Update: 2024-09-12
+
+--- html2text-2.2.3.orig/format.cpp
++++ html2text-2.2.3/format.cpp
+@@ -908,7 +908,7 @@ Input::line_format() const
+                       size = 20;
+               res = '[' + string(size, '*') + ']';
+       } else if (cmp_nocase(type, "CHECKBOX") == 0) {
+-              res = '[' + (checked ? 'X' : ' ') + ']';
++              res = '[' + string{checked ? 'X' : ' '} + ']';
+       } else if (cmp_nocase(type, "RADIO") == 0) {
+               res = checked ? '#' : 'o';
+       } else if (cmp_nocase(type, "SUBMIT") == 0) {
diff --git a/debian/tests/pkgreport.html.supposed 
b/debian/tests/pkgreport.html.supposed
index accd52e..f276dde 100644
--- a/debian/tests/pkgreport.html.supposed
+++ b/debian/tests/pkgreport.html.supposed
@@ -514,10 +514,10 @@ From other Branch bugs -- Critical bugs (30 bugs)
 ***** Categorize using
 *****
 ***** Order by *****
-                         ??Repeat Merged
-                         ??Reverse Bugs
-                         ??Reverse Pending
-                         ??Reverse Severity
+                         [ ]Repeat Merged
+                         [ ]Reverse Bugs
+                         [ ]Reverse Pending
+                         [ ]Reverse Severity
                          [One of: None/testing/
 ***** Misc options ***** oldstable/experimental/
                          unstable/stable]
-- 
2.45.2

Reply via email to