mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 15:28:05 +03:00
GCS: remove compat code
This commit is contained in:
@@ -8247,7 +8247,7 @@ func getSftpClientWithAddr(user dataprovider.User, usePubKey bool, addr string)
|
|||||||
}
|
}
|
||||||
config.Auth = []ssh.AuthMethod{ssh.PublicKeys(signer)}
|
config.Auth = []ssh.AuthMethod{ssh.PublicKeys(signer)}
|
||||||
} else {
|
} else {
|
||||||
if len(user.Password) > 0 {
|
if user.Password != "" {
|
||||||
config.Auth = []ssh.AuthMethod{ssh.Password(user.Password)}
|
config.Auth = []ssh.AuthMethod{ssh.Password(user.Password)}
|
||||||
} else {
|
} else {
|
||||||
config.Auth = []ssh.AuthMethod{ssh.Password(defaultPassword)}
|
config.Auth = []ssh.AuthMethod{ssh.Password(defaultPassword)}
|
||||||
@@ -8370,8 +8370,8 @@ func sftpUploadFile(localSourcePath string, remoteDestPath string, expectedSize
|
|||||||
destFile.Close()
|
destFile.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// we need to close the file to trigger the close method on server
|
// we need to close the file to trigger the server side close method
|
||||||
// we cannot defer closing or Lstat will fail for uploads in atomic mode
|
// we cannot defer closing otherwise Stat will fail for upload atomic mode
|
||||||
destFile.Close()
|
destFile.Close()
|
||||||
if expectedSize > 0 {
|
if expectedSize > 0 {
|
||||||
fi, err := client.Stat(remoteDestPath)
|
fi, err := client.Stat(remoteDestPath)
|
||||||
@@ -8417,8 +8417,8 @@ func sftpUploadResumeFile(localSourcePath string, remoteDestPath string, expecte
|
|||||||
destFile.Close()
|
destFile.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// we need to close the file to trigger the close method on server
|
// we need to close the file to trigger the server side close method
|
||||||
// we cannot defer closing or Lstat will fail for upload atomic mode
|
// we cannot defer closing otherwise Stat will fail for upload atomic mode
|
||||||
destFile.Close()
|
destFile.Close()
|
||||||
if expectedSize > 0 {
|
if expectedSize > 0 {
|
||||||
fi, err := client.Lstat(remoteDestPath)
|
fi, err := client.Lstat(remoteDestPath)
|
||||||
|
|||||||
@@ -275,11 +275,6 @@ func (fs *GCSFs) Remove(name string, isDir bool) error {
|
|||||||
|
|
||||||
err := fs.svc.Bucket(fs.config.Bucket).Object(name).Delete(ctx)
|
err := fs.svc.Bucket(fs.config.Bucket).Object(name).Delete(ctx)
|
||||||
metrics.GCSDeleteObjectCompleted(err)
|
metrics.GCSDeleteObjectCompleted(err)
|
||||||
if fs.IsNotExist(err) && isDir {
|
|
||||||
name = name + "/"
|
|
||||||
err = fs.svc.Bucket(fs.config.Bucket).Object(name).Delete(ctx)
|
|
||||||
metrics.GCSDeleteObjectCompleted(err)
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1561,7 +1561,7 @@ func downloadFile(remoteSourcePath string, localDestPath string, expectedSize in
|
|||||||
func getWebDavClient(user dataprovider.User) *gowebdav.Client {
|
func getWebDavClient(user dataprovider.User) *gowebdav.Client {
|
||||||
rootPath := fmt.Sprintf("http://%v/", webDavServerAddr)
|
rootPath := fmt.Sprintf("http://%v/", webDavServerAddr)
|
||||||
pwd := defaultPassword
|
pwd := defaultPassword
|
||||||
if len(user.Password) > 0 {
|
if user.Password != "" {
|
||||||
pwd = user.Password
|
pwd = user.Password
|
||||||
}
|
}
|
||||||
client := gowebdav.NewClient(rootPath, user.Username, pwd)
|
client := gowebdav.NewClient(rootPath, user.Username, pwd)
|
||||||
|
|||||||
Reference in New Issue
Block a user