mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-16 12:09:13 +08:00
chore: Clean up some unused code
This commit is contained in:
parent
4209ee4486
commit
6752c5a403
3 changed files with 4 additions and 11 deletions
|
|
@ -126,12 +126,8 @@ func (s s3Client) Upload(src, target string) (bool, error) {
|
|||
}
|
||||
|
||||
func (s s3Client) Download(src, target string) (bool, error) {
|
||||
if _, err := os.Stat(target); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
os.Remove(target)
|
||||
} else {
|
||||
return false, err
|
||||
}
|
||||
if _, err := os.Stat(target); err == nil {
|
||||
_ = os.Remove(target)
|
||||
}
|
||||
file, err := os.Create(target)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -80,11 +80,9 @@ func (g *googleDriveClient) Delete(pathItem string) (bool, error) {
|
|||
if len(fileInfo.ID) == 0 {
|
||||
return false, fmt.Errorf("no such file %s", pathItem)
|
||||
}
|
||||
res, err := g.googleRequest("https://www.googleapis.com/drive/v3/files/"+fileInfo.ID, http.MethodDelete, nil, nil)
|
||||
if err != nil {
|
||||
if _, err := g.googleRequest("https://www.googleapis.com/drive/v3/files/"+fileInfo.ID, http.MethodDelete, nil, nil); err != nil {
|
||||
return false, err
|
||||
}
|
||||
fmt.Println(string(res))
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
|
||||
"github.com/upyun/go-sdk/upyun"
|
||||
|
|
@ -34,7 +33,7 @@ func (o upClient) ListBuckets() ([]interface{}, error) {
|
|||
func (s upClient) Upload(src, target string) (bool, error) {
|
||||
if _, err := s.client.GetInfo(path.Dir(target)); err != nil {
|
||||
if err := s.client.Mkdir(path.Dir(target)); err != nil {
|
||||
fmt.Println(err)
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
if err := s.client.Put(&upyun.PutObjectConfig{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue