mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
WebClient: improve error message when trying to move non-empty folder
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -482,7 +482,7 @@ func (*AzureBlobFs) IsNotSupported(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
return err == ErrVfsUnsupported
|
||||
return errors.Is(err, ErrVfsUnsupported)
|
||||
}
|
||||
|
||||
func (*AzureBlobFs) isBadRequestError(err error) bool {
|
||||
@@ -782,7 +782,7 @@ func (fs *AzureBlobFs) renameInternal(source, target string, fi os.FileInfo, rec
|
||||
return numFiles, filesSize, err
|
||||
}
|
||||
if hasContents {
|
||||
return numFiles, filesSize, fmt.Errorf("cannot rename non empty directory: %q", source)
|
||||
return numFiles, filesSize, fmt.Errorf("%w: cannot rename non empty directory: %q", ErrVfsUnsupported, source)
|
||||
}
|
||||
}
|
||||
if err := fs.mkdirInternal(target); err != nil {
|
||||
|
||||
@@ -19,6 +19,7 @@ package vfs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime"
|
||||
@@ -448,7 +449,7 @@ func (*GCSFs) IsNotSupported(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
return err == ErrVfsUnsupported
|
||||
return errors.Is(err, ErrVfsUnsupported)
|
||||
}
|
||||
|
||||
// CheckRootPath creates the specified local root directory if it does not exists
|
||||
@@ -774,7 +775,7 @@ func (fs *GCSFs) renameInternal(source, target string, fi os.FileInfo, recursion
|
||||
return numFiles, filesSize, err
|
||||
}
|
||||
if hasContents {
|
||||
return numFiles, filesSize, fmt.Errorf("cannot rename non empty directory: %q", source)
|
||||
return numFiles, filesSize, fmt.Errorf("%w: cannot rename non empty directory: %q", ErrVfsUnsupported, source)
|
||||
}
|
||||
}
|
||||
if err := fs.mkdirInternal(target); err != nil {
|
||||
|
||||
@@ -482,7 +482,7 @@ func (*S3Fs) IsNotSupported(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
return err == ErrVfsUnsupported
|
||||
return errors.Is(err, ErrVfsUnsupported)
|
||||
}
|
||||
|
||||
// CheckRootPath creates the specified local root directory if it does not exists
|
||||
@@ -700,7 +700,7 @@ func (fs *S3Fs) renameInternal(source, target string, fi os.FileInfo, recursion
|
||||
return numFiles, filesSize, err
|
||||
}
|
||||
if hasContents {
|
||||
return numFiles, filesSize, fmt.Errorf("cannot rename non empty directory: %q", source)
|
||||
return numFiles, filesSize, fmt.Errorf("%w: cannot rename non empty directory: %q", ErrVfsUnsupported, source)
|
||||
}
|
||||
}
|
||||
if err := fs.mkdirInternal(target); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user