🎨 Optimize code structure

This commit is contained in:
微凉
2022-01-03 20:06:36 +08:00
parent e7ba289d06
commit 7cf30836bf
18 changed files with 269 additions and 342 deletions

View File

@ -193,6 +193,10 @@ func (driver S3) Move(src string, dst string, account *model.Account) error {
return driver.Delete(src, account)
}
func (driver S3) Rename(src string, dst string, account *model.Account) error {
return driver.Move(src, dst, account)
}
func (driver S3) Copy(src string, dst string, account *model.Account) error {
client, err := driver.GetClient(account)
if err != nil {
@ -210,9 +214,6 @@ func (driver S3) Copy(src string, dst string, account *model.Account) error {
Key: &dstKey,
}
_, err = client.CopyObject(input)
if err == nil {
_ = base.DeleteCache(dst, account)
}
return err
}
@ -231,9 +232,6 @@ func (driver S3) Delete(path string, account *model.Account) error {
Key: &key,
}
_, err = client.DeleteObject(input)
if err == nil {
_ = base.DeleteCache(utils.Dir(path), account)
}
return err
}
@ -253,9 +251,6 @@ func (driver S3) Upload(file *model.FileStream, account *model.Account) error {
Body: file,
}
_, err := uploader.Upload(input)
if err == nil {
_ = base.DeleteCache(file.ParentPath, account)
}
return err
}