SftpServer: quick fix for spaces in filename
This commit is contained in:
@@ -28,6 +28,8 @@ public class SftpServer implements Server {
|
|||||||
|
|
||||||
public URI upload (String name, ByteSource source) {
|
public URI upload (String name, ByteSource source) {
|
||||||
try {
|
try {
|
||||||
|
final URI target = URI.create(uri.toString() + "/" + name.replace(" ", "%20"));
|
||||||
|
|
||||||
final JSch jsch = new JSch();
|
final JSch jsch = new JSch();
|
||||||
final Session session = jsch.getSession(username, host, port);
|
final Session session = jsch.getSession(username, host, port);
|
||||||
session.setPassword(password);
|
session.setPassword(password);
|
||||||
@@ -45,7 +47,7 @@ public class SftpServer implements Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
session.disconnect();
|
session.disconnect();
|
||||||
return URI.create(uri.toString() + "/" + name);
|
return target;
|
||||||
} catch (final JSchException | IOException | SftpException exception) {
|
} catch (final JSchException | IOException | SftpException exception) {
|
||||||
throw new RuntimeException(exception);
|
throw new RuntimeException(exception);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user