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); }