diff --git a/sftpd/sftpd_test.go b/sftpd/sftpd_test.go index 5aeeed95..29a9fea5 100644 --- a/sftpd/sftpd_test.go +++ b/sftpd/sftpd_test.go @@ -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) diff --git a/vfs/gcsfs.go b/vfs/gcsfs.go index 0f5832a5..7acc7db9 100644 --- a/vfs/gcsfs.go +++ b/vfs/gcsfs.go @@ -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 } diff --git a/webdavd/webdavd_test.go b/webdavd/webdavd_test.go index 3b5dfd93..3ab2c28b 100644 --- a/webdavd/webdavd_test.go +++ b/webdavd/webdavd_test.go @@ -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)