From 758d6d307fe6afcc4488360e7db03162103974f5 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 15 May 2020 13:02:58 +0200 Subject: view/utils: Show attachment size. --- mumi/web/view/utils.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mumi/web/view/utils.scm b/mumi/web/view/utils.scm index 27cd2de..3c95644 100644 --- a/mumi/web/view/utils.scm +++ b/mumi/web/view/utils.scm @@ -18,6 +18,7 @@ ;;; . (define-module (mumi web view utils) + #:use-module (ice-9 format) #:use-module (ice-9 rdelim) #:use-module (ice-9 match) #:use-module (ice-9 regex) @@ -250,7 +251,15 @@ BUG-NUM), even when it is a multipart message." ((or html? hide-attachment?) `(div (@ (class "attachment")) "Attachment: " - (a (@ (href ,(attachment-url))) ,attachment-name))) + (a (@ (href ,(attachment-url))) ,attachment-name) + ,(or (and=> (assoc-ref headers 'content-disposition) + (lambda (disposition) + (and=> (assoc-ref disposition 'size) + (lambda (bytes) + (format #f " (~1,2f MiB)" + (exact->inexact + (/ bytes 1024 1024))))))) + ""))) ((string-suffix? ".scm" attachment-name) `(div (@ (class "multipart scheme")) (div (@ (class "download-part")) -- cgit v1.2.3