From 806a61a5b47a3c17511319dc145063d8caff2b09 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 28 Jan 2019 23:54:17 +0100 Subject: view: Handle bytevector mime parts. * mumi/web/view/utils.scm (display-message-body): Handle mime entities with a bytevector part. --- mumi/web/view/utils.scm | 15 ++++++++++++--- 1 file 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 +;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus ;;; Copyright © 2018, 2019 Arun Isaac ;;; ;;; 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." (($ headers (? string? body)) (apply display-multipart-chunk `(,headers ,body ,path))) ;; Message parts can be nested. - (($ headers sub-parts) + (($ 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. + (($ headers (? bytevector? raw)) + (apply display-multipart-chunk + `(,headers + ,(bytevector->string raw "ISO-8859-1") + ,path))))) (cond ((multipart-message? message) (let ((parts (email-body message))) -- cgit v1.2.3