summary refs log tree commit diff
path: root/email
diff options
context:
space:
mode:
Diffstat (limited to 'email')
-rw-r--r--email/quoted-printable.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/email/quoted-printable.scm b/email/quoted-printable.scm
index 2c5d7a7..d986346 100644
--- a/email/quoted-printable.scm
+++ b/email/quoted-printable.scm
@@ -1,5 +1,6 @@
 ;;; guile-email --- Guile email parser
 ;;; Copyright © 2018, 2020 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2023 Andrew Whatson <whatson@tailcall.au>
 ;;;
 ;;; This file is part of guile-email.
 ;;;
@@ -41,11 +42,14 @@
        (cond
         ((eof-object? c) out)
         ((char=? c #\=)
-         ;; TODO: Support "\r\n" line ending
          (let ((c1 (read-char in)))
+           ;; Skip if \n was read.
            (unless (char=? c1 #\Newline)
              (let ((c2 (read-char in)))
-               (put-u8 out (string->number (string c1 c2) 16)))))
+               ;; Skip if \r\n was read.
+               (unless (and (char=? c1 #\Return)
+                            (char=? c2 #\Newline))
+                 (put-u8 out (string->number (string c1 c2) 16))))))
          (quoted-printable-decode in out))
         (else (put-u8 out (char->integer c))
               (quoted-printable-decode in out)))))))