mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 00:04:19 +00:00
webdav: rename MoveAll to Move
This commit is contained in:
parent
4493704689
commit
790ebfc5f8
@ -278,8 +278,8 @@ func (c *Client) Copy(ctx context.Context, name, dest string, options *CopyOptio
|
||||
return nil
|
||||
}
|
||||
|
||||
// MoveAll moves a file.
|
||||
func (c *Client) MoveAll(ctx context.Context, name, dest string, overwrite bool) error {
|
||||
// Move moves a file.
|
||||
func (c *Client) Move(ctx context.Context, name, dest string, overwrite bool) error {
|
||||
req, err := c.ic.NewRequest("MOVE", name, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -214,7 +214,7 @@ func (fs LocalFileSystem) Copy(ctx context.Context, src, dst string, options *Co
|
||||
return created, nil
|
||||
}
|
||||
|
||||
func (fs LocalFileSystem) MoveAll(ctx context.Context, src, dst string, overwrite bool) (created bool, err error) {
|
||||
func (fs LocalFileSystem) Move(ctx context.Context, src, dst string, overwrite bool) (created bool, err error) {
|
||||
srcPath, err := fs.localPath(src)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
@ -21,7 +21,7 @@ type FileSystem interface {
|
||||
RemoveAll(ctx context.Context, name string) error
|
||||
Mkdir(ctx context.Context, name string) error
|
||||
Copy(ctx context.Context, name, dest string, options *CopyOptions) (created bool, err error)
|
||||
MoveAll(ctx context.Context, name, dest string, overwrite bool) (created bool, err error)
|
||||
Move(ctx context.Context, name, dest string, overwrite bool) (created bool, err error)
|
||||
}
|
||||
|
||||
// Handler handles WebDAV HTTP requests. It can be used to create a WebDAV
|
||||
@ -243,7 +243,7 @@ func (b *backend) Copy(r *http.Request, dest *internal.Href, recursive, overwrit
|
||||
}
|
||||
|
||||
func (b *backend) Move(r *http.Request, dest *internal.Href, overwrite bool) (created bool, err error) {
|
||||
created, err = b.FileSystem.MoveAll(r.Context(), r.URL.Path, dest.Path, overwrite)
|
||||
created, err = b.FileSystem.Move(r.Context(), r.URL.Path, dest.Path, overwrite)
|
||||
if os.IsExist(err) {
|
||||
return false, &internal.HTTPError{http.StatusPreconditionFailed, err}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user