summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2024-07-26 22:10:36 +0200
committerMichael Albinus <michael.albinus@gmx.de>2024-07-26 22:10:36 +0200
commitd7665595f7bfca86b65e75fa624b0fc7a63fbb41 (patch)
treec307dfb2c6cceeeef6952a5840a68d62c4364c90
parent4e250154ec4dc73eb9a2ec2c00d7a6e9a98b5476 (diff)
Tramp: Handle hops with "%" in their names
* lisp/net/tramp.el (tramp-dissect-file-name, tramp-compute-multi-hops): Handle hops with "%" in their names, like USER%DOMAIN or POD%NAMESPACE.
-rw-r--r--lisp/net/tramp.el23
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 4151b811b42..3260cf5daac 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1770,17 +1770,23 @@ default values are used."
(unless nodefault
(when hop
(setq v (tramp-dissect-hop-name hop)
- hop (and hop (tramp-make-tramp-hop-name v))))
+ hop (tramp-make-tramp-hop-name v)))
(let ((tramp-default-host
(or (and v (not (string-search "%h" (tramp-file-name-host v)))
(tramp-file-name-host v))
tramp-default-host)))
(setq method (tramp-find-method method user host)
user (tramp-find-user method user host)
- host (tramp-find-host method user host)
- hop
- (and hop
- (format-spec hop (format-spec-make ?h host ?u user))))))
+ host (tramp-find-host method user host))
+ (when hop
+ ;; Replace placeholders. The hop could contain "%"
+ ;; which is not intended as format character, for
+ ;; example in USER%DOMAIN or POD%NAMESPACE.
+ (setq hop
+ (replace-regexp-in-string
+ (rx "%" (group (= 2 alnum))) "%%\\1" hop)
+ hop
+ (format-spec hop (format-spec-make ?h host ?u user))))))
;; Return result.
(prog1
@@ -4930,8 +4936,13 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
(if (null proxy)
;; No more hops needed.
(setq choices nil)
- ;; Replace placeholders.
+ ;; Replace placeholders. The proxy could contain "%" which
+ ;; is not intended as format character, for example in
+ ;; USER%DOMAIN or POD%NAMESPACE.
(setq proxy
+ (replace-regexp-in-string
+ (rx "%" (group (= 2 alnum))) "%%\\1" proxy)
+ proxy
(format-spec
proxy
(format-spec-make