X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/acaf905b1130aae80fa59d2c861ffd4c8eb75486..ca1b9b38dcf372b09028acf088f386ef09f2de84:/lisp/url/url-file.el diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index 62052fcaaf..61e83c0997 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el @@ -1,6 +1,6 @@ ;;; url-file.el --- File retrieval code -;; Copyright (C) 1996-1999, 2004-2012 Free Software Foundation, Inc. +;; Copyright (C) 1996-1999, 2004-2016 Free Software Foundation, Inc. ;; Keywords: comm, data, processes @@ -23,11 +23,11 @@ ;;; Code: -(eval-when-compile (require 'cl)) (require 'mailcap) (require 'url-vars) (require 'url-parse) (require 'url-dired) +(declare-function mm-disable-multibyte "mm-util" ()) (defconst url-file-default-port 21 "Default FTP port.") (defconst url-file-asynchronous-p t "FTP transfers are asynchronous.") @@ -41,7 +41,7 @@ can do automatic decompression for them, and won't find 'foo' if 'foo.gz' exists, even though the FTP server would happily serve it up to them." (let ((scratch nil) - (compressed-extensions '("" ".gz" ".z" ".Z" ".bz2")) + (compressed-extensions '("" ".gz" ".z" ".Z" ".bz2" ".xz")) (found nil)) (while (and compressed-extensions (not found)) (if (file-exists-p (setq scratch (concat fname (pop compressed-extensions)))) @@ -167,18 +167,21 @@ to them." (or filename (error "File does not exist: %s" (url-recreate-url url))) ;; Need to figure out the content-type from the real extension, ;; not the compressed one. + ;; FIXME should this regexp not include more extensions; basically + ;; everything that url-file-find-possibly-compressed-file does? (setq uncompressed-filename (if (string-match "\\.\\(gz\\|Z\\|z\\)$" filename) (substring filename 0 (match-beginning 0)) filename)) (setq content-type (mailcap-extension-to-mime (url-file-extension uncompressed-filename)) - content-encoding (case (intern (url-file-extension filename)) - ((\.z \.gz) "gzip") - (\.Z "compress") - (\.uue "x-uuencoded") - (\.hqx "x-hqx") - (\.bz2 "x-bzip2") - (otherwise nil))) + content-encoding (pcase (url-file-extension filename) + ((or ".z" ".gz") "gzip") + (".Z" "compress") + (".uue" "x-uuencoded") + (".hqx" "x-hqx") + (".bz2" "x-bzip2") + (".xz" "x-xz") + (_ nil))) (if (file-directory-p filename) ;; A directory is done the same whether we are local or remote