This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git

commit 2540910dec4decc0d9aa34c5918fcc9d0cd5e6e2
Author: Stefan Bodewig <bode...@apache.org>
AuthorDate: Mon Oct 14 09:15:30 2024 +0200

    lastIndex*O*f
---
 WHATSNEW                                                     | 4 ++++
 src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/WHATSNEW b/WHATSNEW
index 5fdf91528..e7af9c429 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -1,7 +1,11 @@
 Changes from Ant 1.10.15 TO Ant 1.10.16
 =======================================
 
+Fixed bugs:
+-----------
 
+ * <scp> now properly handles IPv6 addresses as hostnames.
+   Bugzilla Report 59160
 
 Changes from Ant 1.10.14 TO Ant 1.10.15
 =======================================
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 8719d3904..07c96896b 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,8 +435,9 @@ public class Scp extends SSHBase {
             throw new BuildException("no username was given.  Can't 
authenticate.");
         }
 
-        // For IPv6 address having more than one ":", it should look for the 
last occurrence
-        final int indexOfPath = uri.lastIndexof(':');
+        // For IPv6 addresses, the host part may contain more than one ":",
+        // look for the last occurrence
+        final int indexOfPath = uri.lastIndexOf(':');
         if (indexOfPath <= indexOfAt) {
             throw new BuildException("no remote path in %s", uri);
         }

Reply via email to