GCS: remove compat code
This commit is contained in:
parent
8cc2dfe5c2
commit
3e1b07324d
3 changed files with 6 additions and 11 deletions
|
@ -8247,7 +8247,7 @@ func getSftpClientWithAddr(user dataprovider.User, usePubKey bool, addr string)
|
|||
}
|
||||
config.Auth = []ssh.AuthMethod{ssh.PublicKeys(signer)}
|
||||
} else {
|
||||
if len(user.Password) > 0 {
|
||||
if user.Password != "" {
|
||||
config.Auth = []ssh.AuthMethod{ssh.Password(user.Password)}
|
||||
} else {
|
||||
config.Auth = []ssh.AuthMethod{ssh.Password(defaultPassword)}
|
||||
|
@ -8370,8 +8370,8 @@ func sftpUploadFile(localSourcePath string, remoteDestPath string, expectedSize
|
|||
destFile.Close()
|
||||
return err
|
||||
}
|
||||
// we need to close the file to trigger the close method on server
|
||||
// we cannot defer closing or Lstat will fail for uploads in atomic mode
|
||||
// we need to close the file to trigger the server side close method
|
||||
// we cannot defer closing otherwise Stat will fail for upload atomic mode
|
||||
destFile.Close()
|
||||
if expectedSize > 0 {
|
||||
fi, err := client.Stat(remoteDestPath)
|
||||
|
@ -8417,8 +8417,8 @@ func sftpUploadResumeFile(localSourcePath string, remoteDestPath string, expecte
|
|||
destFile.Close()
|
||||
return err
|
||||
}
|
||||
// we need to close the file to trigger the close method on server
|
||||
// we cannot defer closing or Lstat will fail for upload atomic mode
|
||||
// we need to close the file to trigger the server side close method
|
||||
// we cannot defer closing otherwise Stat will fail for upload atomic mode
|
||||
destFile.Close()
|
||||
if expectedSize > 0 {
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -1561,7 +1561,7 @@ func downloadFile(remoteSourcePath string, localDestPath string, expectedSize in
|
|||
func getWebDavClient(user dataprovider.User) *gowebdav.Client {
|
||||
rootPath := fmt.Sprintf("http://%v/", webDavServerAddr)
|
||||
pwd := defaultPassword
|
||||
if len(user.Password) > 0 {
|
||||
if user.Password != "" {
|
||||
pwd = user.Password
|
||||
}
|
||||
client := gowebdav.NewClient(rootPath, user.Username, pwd)
|
||||
|
|
Loading…
Reference in a new issue