diff mbox series

[bug#70462] import: beautify-description: Fix ". ." case.

Message ID 20240418230641.2612-1-ngraves@ngraves.fr
State New
Headers show
Series [bug#70462] import: beautify-description: Fix ". ." case. | expand

Commit Message

Nicolas Graves April 18, 2024, 11:06 p.m. UTC
* guix/import/utils.scm (beautify-description): Ensure the matched
string pre is long enough not to fail.

Change-Id: I3172d9a41350b98222cd9ab758487485f26650b3
---
 guix/import/utils.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Ludovic Courtès April 29, 2024, 9:56 p.m. UTC | #1
Nicolas Graves <ngraves@ngraves.fr> skribis:

> * guix/import/utils.scm (beautify-description): Ensure the matched
> string pre is long enough not to fail.
>
> Change-Id: I3172d9a41350b98222cd9ab758487485f26650b3

Applied, thanks!
diff mbox series

Patch

diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 0cf52cdbde..09a01cf315 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -380,9 +380,10 @@  (define* (beautify-description description #:optional (length 80))
                                                       (abbrevs '("Dr" "Mr" "Mrs"
                                                                  "Ms" "Prof" "vs"
                                                                  "e.g")))
-                                                  (if (or (any (cut string-suffix? <> pre) abbrevs)
-                                                          (char-upper-case?
-                                                           (string-ref pre (1- (string-length pre)))))
+                                                  (if (and (> (string-length pre) 0)
+                                                           (or (any (cut string-suffix? <> pre) abbrevs)
+                                                               (char-upper-case?
+                                                                (string-ref pre (1- (string-length pre))))))
                                                       ". "
                                                       ".  ")))
                                               'post)