Fix moving files with duplicate names to trash-can

* lisp/files.el (move-file-to-trash): Fix file name in
trash-can when another deleted file under the same name is
already stored there.  (Bug#37922)

Copyright-paperwork-exempt: yes.
This commit is contained in:
Shingo Tanaka 2019-10-25 22:59:28 +09:00 committed by Eli Zaretskii
parent d8f03d8276
commit a6a9b3061f

View file

@ -7711,7 +7711,8 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
(setq info-fn (make-temp-file
(expand-file-name files-base trash-info-dir)
nil ".trashinfo"))
(setq files-base (file-name-nondirectory info-fn))
(setq files-base (substring (file-name-nondirectory info-fn)
0 (- (length ".trashinfo"))))
(write-region nil nil info-fn nil 'quiet info-fn)))
;; Finally, try to move the file to the trashcan.
(let ((delete-by-moving-to-trash nil)