[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/files.el,v
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/files.el,v |
Date: |
Sat, 01 Mar 2008 01:28:34 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Miles Bader <miles> 08/03/01 01:28:32
Index: lisp/files.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/files.el,v
retrieving revision 1.963
retrieving revision 1.964
diff -u -b -r1.963 -r1.964
--- lisp/files.el 25 Feb 2008 17:42:13 -0000 1.963
+++ lisp/files.el 1 Mar 2008 01:28:24 -0000 1.964
@@ -4656,15 +4656,18 @@
(let ((buffer-name (buffer-name))
(limit 0)
file-name)
- ;; Eliminate all slashes and backslashes by
- ;; replacing them with sequences that start with %.
- ;; Quote % also, to keep distinct names distinct.
- (while (string-match "[/\\%]" buffer-name limit)
+ ;; Restrict the characters used in the file name to those which
+ ;; are known to be safe on all filesystems, url-encoding the
+ ;; rest.
+ ;; We do this on all platforms, because even if we are not
+ ;; running on DOS/Windows, the current directory may be on a
+ ;; mounted VFAT filesystem, such as a USB memory stick.
+ (while (string-match "[^A-Za-z0-9-_.~#+]" buffer-name limit)
(let* ((character (aref buffer-name (match-beginning 0)))
(replacement
- (cond ((eq character ?%) "%%")
- ((eq character ?/) "%+")
- ((eq character ?\\) "%-"))))
+ ;; For multibyte characters, this will produce more than
+ ;; 2 hex digits, so is not true URL encoding.
+ (format "%%%02X" character)))
(setq buffer-name (replace-match replacement t t buffer-name))
(setq limit (1+ (match-end 0)))))
;; Generate the file name.
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Stefan Monnier, 2008/02/16
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Stefan Monnier, 2008/02/18
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Miles Bader, 2008/02/24
- [Emacs-diffs] Changes to emacs/lisp/files.el,v, Chong Yidong, 2008/02/25
- [Emacs-diffs] Changes to emacs/lisp/files.el,v,
Miles Bader <=