summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-04-20 17:58:18 +0300
committerEli Zaretskii <eliz@gnu.org>2021-04-20 17:58:18 +0300
commit2647b7b78c6c40def8f40a0169a27fd265bd4de4 (patch)
treea100b50d559c0490c1da733c6fdc605a6fa8eac1
parent3e93c2e5ae48e8595e80b1fb69955c2e051ca004 (diff)
downloademacs-2647b7b78c6c40def8f40a0169a27fd265bd4de4.tar.gz
Fix Rmail-MIME size estimations
The quoted-printable estimation was obviously wrong: the size becomes smaller when decoded, not larger... * lisp/mail/rmailmm.el (rmail-mime-set-bulk-data): Fix estimations of decoded MIME attachment.
-rw-r--r--lisp/mail/rmailmm.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index e08500a1898..1295a086f52 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -784,9 +784,11 @@ directly."
(let ((encoding (rmail-mime-entity-transfer-encoding entity)))
(setq size (- (aref body 1) (aref body 0)))
(cond ((string= encoding "base64")
- (setq size (/ (* size 3) 4)))
+ ;; https://en.wikipedia.org/wiki/Base64#MIME
+ (setq size (max (* (- size 814) 0.73) 100)))
((string= encoding "quoted-printable")
- (setq size (/ (* size 7) 3)))))))
+ ;; Assume most of the text is ASCII...
+ (setq size (/ (* size 5) 7)))))))
(cond
((string-match "text/html" content-type)