diff options
-rw-r--r-- | mumi/web/view/utils.scm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mumi/web/view/utils.scm b/mumi/web/view/utils.scm index 6f6e16a..27cd2de 100644 --- a/mumi/web/view/utils.scm +++ b/mumi/web/view/utils.scm @@ -234,15 +234,20 @@ BUG-NUM), even when it is a multipart message." (cut assoc-ref <> 'type)) content-type (assoc-ref content-type 'type))) - (binary-attachment? (and attachment? - (member (assoc-ref content-type 'type) - '(application image video)))) + (hide-attachment? (and attachment? + (or (member (assoc-ref content-type 'type) + '(application image video)) + (and=> (assoc-ref headers 'content-disposition) + (lambda (disposition) + (and=> (assoc-ref disposition 'size) + (lambda (size) + (> size 5000)))))))) (attachment-name (or (and=> (assoc-ref headers 'content-disposition) (cut assoc-ref <> 'filename)) "file"))) (cond - ((or html? binary-attachment?) + ((or html? hide-attachment?) `(div (@ (class "attachment")) "Attachment: " (a (@ (href ,(attachment-url))) ,attachment-name))) |