Mohammed Salman created DIRMINA-1097:
----------------------------------------
Summary: Handling extra '@' present in username,password while
creating SftpFileSystemProvider.createFileSystemURI
Key: DIRMINA-1097
URL: https://issues.apache.org/jira/browse/DIRMINA-1097
Project: MINA
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0
Environment: Dell Laptop,
Intel i5-7200U 8gb RAM
Windows 10 pro 64-bit
Reporter: Mohammed Salman
>From the documentation
>[mina-sshd|https://github.com/apache/mina-sshd/blob/master/README.md] ,
{code:java}
URI uri = SftpFileSystemProvider.createFileSystemURI(host, port, username,
password);
{code}
if username or password parameters contain a character '@' , for example,
{code:java}
username = "J@ck";
password = "d@Ripper";
{code}
then the resulting URI has hostname null ,because
{code:java}
SftpFileSystemProvider.createSystemURI{code}
internally uses
{code:java}
URI.create(sb.ToString) {code}
which does not handle this. To solve this, URI constructor should be used as
suggested in the answer
[here|https://stackoverflow.com/questions/26450910/java-sftp-apache-vfs2-password-with]
.
{code:java}
String userInfo = userName + ":" + password; String path = remoteDirectory +
filename; // Need a '/' between them? URI sftpUri = new URI("sftp", userInfo,
remoteServerAddress, portNo, null, null, null);{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)