2005-02-12 Katsumi Yamaoka <yamaoka@jpl.org>
+ * gnus-art.el (gnus-mime-copy-part): Don't decode compressed parts.
+
* mm-util.el (mm-coding-system-to-mime-charset): Make it work with
non-Mule XEmacs as well.
+ (mm-decompress-buffer): Signal an error intentionally if it does
+ not decompress compressed data because auto-compression-mode is
+ disabled.
2005-02-11 Teodor Zlatanov <tzz@lifelogs.com>
(unless handle
(setq handle (get-text-property (point) 'gnus-data)))
(when handle
- (let* ((filename (or (mail-content-type-get (mm-handle-disposition handle)
- 'name)
- (mail-content-type-get (mm-handle-disposition handle)
- 'filename)))
- (contents (mm-with-unibyte-buffer
- (mm-insert-part handle)
- (or (mm-decompress-buffer filename)
+ (let ((filename (or (mail-content-type-get (mm-handle-disposition handle)
+ 'name)
+ (mail-content-type-get (mm-handle-disposition handle)
+ 'filename)))
+ contents dont-decode charset coding-system)
+ (mm-with-unibyte-buffer
+ (mm-insert-part handle)
+ (setq contents (or (condition-case nil
+ (mm-decompress-buffer filename nil 'sig)
+ (error
+ (setq dont-decode t)
+ nil))
(buffer-string))))
- charset coding-system)
- (setq filename (if filename
- (file-name-nondirectory filename)
- "*decoded*"))
+ (setq filename (cond (filename (file-name-nondirectory filename))
+ (dont-decode "*raw data*")
+ (t "*decoded*")))
(cond
+ (dont-decode)
((not arg)
(unless (setq charset (mail-content-type-get
(mm-handle-type handle) 'charset))
(defun mm-decompress-buffer (filename &optional inplace force)
"Decompress buffer's contents, depending on jka-compr.
-Only when FORCE is non-nil or `auto-compression-mode' is enabled and
-FILENAME agrees with `jka-compr-compression-info-list', decompression
-is done. If INPLACE is nil, return decompressed data or nil without
-modifying the buffer. Otherwise, replace the buffer's contents with
-the decompressed data. The buffer's multibyteness must be turned off."
+Only when FORCE is t or `auto-compression-mode' is enabled and FILENAME
+agrees with `jka-compr-compression-info-list', decompression is done.
+Signal an error if FORCE is neither nil nor t and compressed data are
+not decompressed because `auto-compression-mode' is disabled.
+If INPLACE is nil, return decompressed data or nil without modifying
+the buffer. Otherwise, replace the buffer's contents with the
+decompressed data. The buffer's multibyteness must be turned off."
(when (and filename
(if force
(prog1 t (require 'jka-compr))
(jka-compr-installed-p))))
(let ((info (jka-compr-get-compression-info filename)))
(when info
+ (unless (or (memq force (list nil t))
+ (jka-compr-installed-p))
+ (error ""))
(let ((prog (jka-compr-info-uncompress-program info))
(args (jka-compr-info-uncompress-args info))
(msg (format "%s %s..."