diff options
| author | Michael Albinus | 2017-10-25 13:36:49 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-10-25 13:36:49 +0200 |
| commit | 761c630766abf5b59c9b8c8f6edde07b276ea4b4 (patch) | |
| tree | 33b27342de1423fa265d77b20aadb6e014343f38 /lisp | |
| parent | 628b65320953ff5333b332e9010c16941cba177f (diff) | |
| download | emacs-761c630766abf5b59c9b8c8f6edde07b276ea4b4.tar.gz emacs-761c630766abf5b59c9b8c8f6edde07b276ea4b4.zip | |
Fix Bug#28982
* admin/MAINTAINERS: Add test/lisp/url/url-tramp-tests.el.
* lisp/url/url-tramp.el (url-tramp-convert-url-to-tramp)
(url-tramp-convert-tramp-to-url): Adapt to recent Tramp changes.
* test/lisp/url/url-tramp-tests.el: New file. (Bug#28982)
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/url/url-tramp.el | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/lisp/url/url-tramp.el b/lisp/url/url-tramp.el index c28cf6c23a1..0b07bd0d1aa 100644 --- a/lisp/url/url-tramp.el +++ b/lisp/url/url-tramp.el | |||
| @@ -37,33 +37,41 @@ They must also be covered by `url-handler-regexp'." | |||
| 37 | :type '(repeat string)) | 37 | :type '(repeat string)) |
| 38 | 38 | ||
| 39 | (defun url-tramp-convert-url-to-tramp (url) | 39 | (defun url-tramp-convert-url-to-tramp (url) |
| 40 | "Convert URL to a Tramp file name." | 40 | "Convert URL to a Tramp file name. |
| 41 | (let ((obj (url-generic-parse-url (and (stringp url) url)))) | 41 | If URL contains a password, it will be added to the `password-data' cache. |
| 42 | (if (member (url-type obj) url-tramp-protocols) | 42 | In case URL is not convertable, nil is returned." |
| 43 | (progn | 43 | (let* ((obj (url-generic-parse-url (and (stringp url) url))) |
| 44 | (if (url-password obj) | 44 | (port |
| 45 | (password-cache-add | 45 | (and (natnump (url-portspec obj)) |
| 46 | (tramp-make-tramp-file-name | 46 | (number-to-string (url-portspec obj))))) |
| 47 | (url-type obj) (url-user obj) (url-host obj) "") | 47 | (when (member (url-type obj) url-tramp-protocols) |
| 48 | (url-password obj)) | 48 | (when (url-password obj) |
| 49 | (tramp-make-tramp-file-name | 49 | (password-cache-add |
| 50 | (url-type obj) (url-user obj) (url-host obj) (url-filename obj)))) | 50 | (tramp-make-tramp-file-name |
| 51 | url))) | 51 | (url-type obj) (url-user obj) nil |
| 52 | (url-host obj) port "") | ||
| 53 | (url-password obj))) | ||
| 54 | (tramp-make-tramp-file-name | ||
| 55 | (url-type obj) (url-user obj) nil | ||
| 56 | (url-host obj) port (url-filename obj))))) | ||
| 52 | 57 | ||
| 53 | (defun url-tramp-convert-tramp-to-url (file) | 58 | (defun url-tramp-convert-tramp-to-url (file) |
| 54 | "Convert FILE, a Tramp file name, to a URL." | 59 | "Convert FILE, a Tramp file name, to a URL. |
| 55 | (let ((obj (ignore-errors (tramp-dissect-file-name file)))) | 60 | In case FILE is not convertable, nil is returned." |
| 56 | (if (member (tramp-file-name-method obj) url-tramp-protocols) | 61 | (let* ((obj (ignore-errors (tramp-dissect-file-name file))) |
| 57 | (url-recreate-url | 62 | (port |
| 58 | (url-parse-make-urlobj | 63 | (and (stringp (tramp-file-name-port obj)) |
| 59 | (tramp-file-name-method obj) | 64 | (string-to-number (tramp-file-name-port obj))))) |
| 60 | (tramp-file-name-user obj) | 65 | (when (member (tramp-file-name-method obj) url-tramp-protocols) |
| 61 | nil ; password. | 66 | (url-recreate-url |
| 62 | (tramp-file-name-host obj) | 67 | (url-parse-make-urlobj |
| 63 | nil ; port. | 68 | (tramp-file-name-method obj) |
| 64 | (tramp-file-name-localname obj) | 69 | (tramp-file-name-user obj) |
| 65 | nil nil t)) ; target attributes fullness. | 70 | nil ; password. |
| 66 | file))) | 71 | (tramp-file-name-host obj) |
| 72 | port | ||
| 73 | (tramp-file-name-localname obj) | ||
| 74 | nil nil t))))) ; target attributes fullness. | ||
| 67 | 75 | ||
| 68 | ;;;###autoload | 76 | ;;;###autoload |
| 69 | (defun url-tramp-file-handler (operation &rest args) | 77 | (defun url-tramp-file-handler (operation &rest args) |