From e0a636389911cf221832646569702b70c7096169 Mon Sep 17 00:00:00 2001 From: FROZENCADET <51886109+FROZENCADET@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:59:11 +0530 Subject: [PATCH] BUG-ID : 59160 , fix extracting host for ipv6 address --- src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java index 3d181d30ee..b86f4dc32a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java @@ -435,7 +435,8 @@ private String parseUri(final String uri) { throw new BuildException("no username was given. Can't authenticate."); } - final int indexOfPath = uri.indexOf(':', indexOfAt + 1); + // For IPv6 address having more than one ":", it should look for the last occurrence + final int indexOfPath = uri.lastIndexof(':'); if (indexOfPath == -1) { throw new BuildException("no remote path in %s", uri); }