mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 23:20:24 +00:00
scp: minor improvements
document that we don't support wildcard expansion. I should refactor scp code ...
This commit is contained in:
parent
aa40b04576
commit
a8a17a223a
2 changed files with 6 additions and 5 deletions
|
@ -32,7 +32,7 @@ If the user cannot create symlinks we add the option `--munge-links`, if it is n
|
|||
|
||||
SFTPGo supports the following built-in SSH commands:
|
||||
|
||||
- `scp`, SFTPGo implements the SCP protocol so we can support it for cloud filesystems too and we can avoid the other system commands limitations. SCP between two remote hosts is supported using the `-3` scp option.
|
||||
- `scp`, SFTPGo implements the SCP protocol so we can support it for cloud filesystems too and we can avoid the other system commands limitations. SCP between two remote hosts is supported using the `-3` scp option. Wildcard expansion is not supported.
|
||||
- `md5sum`, `sha1sum`, `sha256sum`, `sha384sum`, `sha512sum`. Useful to check message digests for uploaded files.
|
||||
- `cd`, `pwd`. Some SFTP clients do not support the SFTP SSH_FXP_REALPATH packet type, so they use `cd` and `pwd` SSH commands to get the initial directory. Currently `cd` does nothing and `pwd` always returns the `/` path. These commands will work with any storage backend but keep in mind that to calculate the hash we need to read the whole file, for remote backends this means downloading the file, for the encrypted backend this means decrypting the file.
|
||||
- `sftpgo-copy`. This is a built-in copy implementation. It allows server side copy for files and directories. The first argument is the source file/directory and the second one is the destination file/directory, for example `sftpgo-copy <src> <dst>`. The command will fail if the destination exists. Copy for directories spanning virtual folders is not supported. Only local filesystem is supported: recursive copy for Cloud Storage filesystems requires a new request for every file in any case, so a real server side copy is not possible.
|
||||
|
|
|
@ -541,7 +541,7 @@ func (c *scpCommand) readConfirmationMessage() error {
|
|||
break
|
||||
}
|
||||
if n > 0 {
|
||||
msg.WriteString(string(readed))
|
||||
msg.Write(readed)
|
||||
}
|
||||
}
|
||||
c.connection.Log(logger.LevelInfo, "scp error message received: %v is error: %v", msg.String(), isError)
|
||||
|
@ -567,7 +567,7 @@ func (c *scpCommand) readProtocolMessage() (string, error) {
|
|||
if n == 1 && readed[0] == newLine[0] {
|
||||
break
|
||||
}
|
||||
command.WriteString(string(readed))
|
||||
command.Write(readed)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -605,7 +605,6 @@ func (c *scpCommand) sendProtocolMessage(message string) error {
|
|||
}
|
||||
|
||||
// get the next upload protocol message ignoring T command if any
|
||||
// we use our own user setting for permissions
|
||||
func (c *scpCommand) getNextUploadProtocolMessage() (string, error) {
|
||||
var command string
|
||||
var err error
|
||||
|
@ -631,6 +630,8 @@ func (c *scpCommand) createDir(dirPath string) error {
|
|||
var isDir bool
|
||||
isDir, err = vfs.IsDirectory(c.connection.Fs, dirPath)
|
||||
if err == nil && isDir {
|
||||
// if this is a virtual dir the resolved path will exist, we don't need a specific check
|
||||
// TODO: remember to check if it's okay when we'll add virtual folders support to cloud backends
|
||||
c.connection.Log(logger.LevelDebug, "directory %#v already exists", dirPath)
|
||||
return nil
|
||||
}
|
||||
|
@ -675,7 +676,7 @@ func (c *scpCommand) parseUploadMessage(command string) (int64, string, error) {
|
|||
return size, name, err
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("Error splitting upload message: %#v", command)
|
||||
err = fmt.Errorf("unable to split upload message: %#v", command)
|
||||
c.connection.Log(logger.LevelWarn, "error: %v", err)
|
||||
c.sendErrorMessage(err)
|
||||
return size, name, err
|
||||
|
|
Loading…
Reference in a new issue