summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-01-28 23:54:17 +0100
committerRicardo Wurmus <rekado@elephly.net>2019-01-28 23:55:34 +0100
commit806a61a5b47a3c17511319dc145063d8caff2b09 (patch)
tree506554bc224609b784cb3a4c269cdceb02a90d05
parentea5a738010148284aed211da953ad670003aefea (diff)
view: Handle bytevector mime parts.
* mumi/web/view/utils.scm (display-message-body): Handle mime entities with a bytevector part.
-rw-r--r--mumi/web/view/utils.scm15
1 files changed, 12 insertions, 3 deletions
diff --git a/mumi/web/view/utils.scm b/mumi/web/view/utils.scm
index bb45a33..584b9a9 100644
--- a/mumi/web/view/utils.scm
+++ b/mumi/web/view/utils.scm
@@ -1,5 +1,5 @@
;;; mumi -- Mediocre, uh, mail interface
-;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This program is free software: you can redistribute it and/or
@@ -21,12 +21,14 @@
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (ice-9 receive)
+ #:use-module (ice-9 iconv)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (syntax-highlight)
#:use-module (syntax-highlight scheme)
#:use-module (email email)
#:use-module (mumi messages)
+ #:use-module (rnrs bytevectors)
#:export (prettify
avatar-color
display-message-body))
@@ -152,12 +154,19 @@ BUG-NUM), even when it is a multipart message."
(($ <mime-entity> headers (? string? body))
(apply display-multipart-chunk `(,headers ,body ,path)))
;; Message parts can be nested.
- (($ <mime-entity> headers sub-parts)
+ (($ <mime-entity> headers (? list? sub-parts))
(map (lambda (part sub-part-num)
(apply display-mime-entity part
(append path (list sub-part-num))))
sub-parts
- (iota (length sub-parts))))))
+ (iota (length sub-parts))))
+ ;; XXX: Sometimes we get an unparseable bytevector. Convert it
+ ;; when that happens.
+ (($ <mime-entity> headers (? bytevector? raw))
+ (apply display-multipart-chunk
+ `(,headers
+ ,(bytevector->string raw "ISO-8859-1")
+ ,path)))))
(cond
((multipart-message? message)
(let ((parts (email-body message)))