From db05b7d3b9d442aa7ac0a18eeda3d1c1742745e8 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 5 Jul 2000 22:57:14 +0000 Subject: [PATCH] Read non-text attachments in binary mode. --- v7/src/edwin/sendmail.scm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/v7/src/edwin/sendmail.scm b/v7/src/edwin/sendmail.scm index 9ec6a956f..dfa7c92f0 100644 --- a/v7/src/edwin/sendmail.scm +++ b/v7/src/edwin/sendmail.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: sendmail.scm,v 1.65 2000/07/05 22:37:58 cph Exp $ +;;; $Id: sendmail.scm,v 1.66 2000/07/05 22:57:14 cph Exp $ ;;; ;;; Copyright (c) 1991-2000 Massachusetts Institute of Technology ;;; @@ -943,15 +943,18 @@ the user from the mailer." #f))) (lambda (initialize update finalize text?) (let ((context (initialize output-port text?))) - (call-with-input-file (mime-attachment-pathname attachment) - (lambda (input-port) - (let ((buffer (make-string 4096))) - (let loop () - (let ((n-read (read-string! buffer input-port))) - (if (> n-read 0) - (begin - (update context buffer 0 n-read) - (loop)))))))) + ((if (eq? type 'TEXT) + call-with-input-file + call-with-binary-input-file) + (mime-attachment-pathname attachment) + (lambda (input-port) + (let ((buffer (make-string 4096))) + (let loop () + (let ((n-read (read-string! buffer input-port))) + (if (> n-read 0) + (begin + (update context buffer 0 n-read) + (loop)))))))) (finalize context))))))))) (define (enable-buffer-mime-processing! buffer) -- 2.25.1