mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:23:47 +01:00
touch: fix using -R on certain backends
On backends which return a valid object for "" with NewObject then touch was going wrong as it thought it was passed an object. This should not happen normally but s3 can be configured with --s3-no-head where it is happy to believe that all objects exist.
This commit is contained in:
parent
cbcfb90d9a
commit
18e9d039ad
@ -139,7 +139,12 @@ func Touch(ctx context.Context, f fs.Fs, remote string) error {
|
||||
return err
|
||||
}
|
||||
fs.Debugf(nil, "Touch time %v", t)
|
||||
file, err := f.NewObject(ctx, remote)
|
||||
var file fs.Object
|
||||
if remote == "" {
|
||||
err = fs.ErrorIsDir
|
||||
} else {
|
||||
file, err = f.NewObject(ctx, remote)
|
||||
}
|
||||
if err != nil {
|
||||
if errors.Is(err, fs.ErrorObjectNotFound) {
|
||||
// Touching non-existent path, possibly creating it as new file
|
||||
|
Loading…
Reference in New Issue
Block a user