mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
This reverts commit bba7c23957.
This commit is contained in:
8
vendor/github.com/asticode/go-astikit/ssh.go
generated
vendored
8
vendor/github.com/asticode/go-astikit/ssh.go
generated
vendored
@@ -6,7 +6,6 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// SSHSession represents an SSH Session
|
||||
@@ -28,9 +27,6 @@ func SSHCopyFileFunc(fn SSHSessionFunc) CopyFileFunc {
|
||||
return
|
||||
}
|
||||
|
||||
// Escape dir path
|
||||
d := strings.ReplaceAll(filepath.Dir(dst), " ", "\\ ")
|
||||
|
||||
// Using local closure allows better readibility for the defer c.Close() since it
|
||||
// isolates the use of the ssh session
|
||||
if err = func() (err error) {
|
||||
@@ -44,7 +40,7 @@ func SSHCopyFileFunc(fn SSHSessionFunc) CopyFileFunc {
|
||||
defer c.Close()
|
||||
|
||||
// Create the destination folder
|
||||
if err = s.Run("mkdir -p " + d); err != nil {
|
||||
if err = s.Run("mkdir -p " + filepath.Dir(dst)); err != nil {
|
||||
err = fmt.Errorf("astikit: creating %s failed: %w", filepath.Dir(dst), err)
|
||||
return
|
||||
}
|
||||
@@ -74,7 +70,7 @@ func SSHCopyFileFunc(fn SSHSessionFunc) CopyFileFunc {
|
||||
defer stdin.Close()
|
||||
|
||||
// Use "scp" command
|
||||
if err = s.Start("scp -qt " + d); err != nil {
|
||||
if err = s.Start("scp -qt \"" + filepath.Dir(dst) + "\""); err != nil {
|
||||
err = fmt.Errorf("astikit: scp to %s failed: %w", dst, err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user