diff --git a/drivers/123/driver.go b/drivers/123/driver.go index ba3157f9050..7884462395b 100644 --- a/drivers/123/driver.go +++ b/drivers/123/driver.go @@ -257,8 +257,4 @@ func (d *Pan123) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr return err } -func (d *Pan123) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Pan123)(nil) diff --git a/drivers/139/driver.go b/drivers/139/driver.go index 18aec2a3406..58a5a4dc382 100644 --- a/drivers/139/driver.go +++ b/drivers/139/driver.go @@ -319,8 +319,4 @@ func (d *Yun139) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr return nil } -func (d *Yun139) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Yun139)(nil) diff --git a/drivers/189/driver.go b/drivers/189/driver.go index a27312572b9..34f0568bda5 100644 --- a/drivers/189/driver.go +++ b/drivers/189/driver.go @@ -7,7 +7,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/go-resty/resty/v2" @@ -208,8 +207,4 @@ func (d *Cloud189) Put(ctx context.Context, dstDir model.Obj, stream model.FileS return d.newUpload(dstDir, stream, up) } -func (d *Cloud189) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Cloud189)(nil) diff --git a/drivers/189pc/driver.go b/drivers/189pc/driver.go index 6e4107e03a6..11d32cca99d 100644 --- a/drivers/189pc/driver.go +++ b/drivers/189pc/driver.go @@ -10,7 +10,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/go-resty/resty/v2" @@ -278,7 +277,3 @@ func (y *Yun189PC) Put(ctx context.Context, dstDir model.Obj, stream model.FileS } return y.CommonUpload(ctx, dstDir, stream, up) } - -func (y *Yun189PC) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} diff --git a/drivers/baidu_netdisk/driver.go b/drivers/baidu_netdisk/driver.go index 310090c4a01..3f3f326364f 100644 --- a/drivers/baidu_netdisk/driver.go +++ b/drivers/baidu_netdisk/driver.go @@ -15,7 +15,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" log "github.com/sirupsen/logrus" @@ -231,8 +230,4 @@ func (d *BaiduNetdisk) Put(ctx context.Context, dstDir model.Obj, stream model.F return err } -func (d *BaiduNetdisk) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*BaiduNetdisk)(nil) diff --git a/drivers/ftp/driver.go b/drivers/ftp/driver.go index fed9238c679..72bde4f07ea 100644 --- a/drivers/ftp/driver.go +++ b/drivers/ftp/driver.go @@ -127,8 +127,4 @@ func (d *FTP) Put(ctx context.Context, dstDir model.Obj, stream model.FileStream return d.conn.Stor(stdpath.Join(dstDir.GetPath(), stream.GetName()), stream) } -func (d *FTP) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*FTP)(nil) diff --git a/drivers/google_drive/driver.go b/drivers/google_drive/driver.go index 59f99fe3d8d..41d84d2b9ca 100644 --- a/drivers/google_drive/driver.go +++ b/drivers/google_drive/driver.go @@ -141,8 +141,4 @@ func (d *GoogleDrive) Put(ctx context.Context, dstDir model.Obj, stream model.Fi return err } -func (d *GoogleDrive) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*GoogleDrive)(nil) diff --git a/drivers/local/driver.go b/drivers/local/driver.go index fee00bdd349..fc49e142e98 100644 --- a/drivers/local/driver.go +++ b/drivers/local/driver.go @@ -217,8 +217,4 @@ func (d *Local) Put(ctx context.Context, dstDir model.Obj, stream model.FileStre return nil } -func (d *Local) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Local)(nil) diff --git a/drivers/mediatrack/driver.go b/drivers/mediatrack/driver.go index a5500ce655e..a34125e0655 100644 --- a/drivers/mediatrack/driver.go +++ b/drivers/mediatrack/driver.go @@ -13,7 +13,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/internal/op" "github.com/alist-org/alist/v3/pkg/utils" @@ -221,8 +220,4 @@ func (d *MediaTrack) Put(ctx context.Context, dstDir model.Obj, stream model.Fil return err } -func (d *MediaTrack) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*MediaTrack)(nil) diff --git a/drivers/onedrive/driver.go b/drivers/onedrive/driver.go index 0b464ce717b..d320821a23d 100644 --- a/drivers/onedrive/driver.go +++ b/drivers/onedrive/driver.go @@ -144,8 +144,4 @@ func (d *Onedrive) Put(ctx context.Context, dstDir model.Obj, stream model.FileS return err } -func (d *Onedrive) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Onedrive)(nil) diff --git a/drivers/pikpak/driver.go b/drivers/pikpak/driver.go index 10da567e537..2769c19d78e 100644 --- a/drivers/pikpak/driver.go +++ b/drivers/pikpak/driver.go @@ -12,7 +12,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/aws/aws-sdk-go/aws" @@ -199,8 +198,4 @@ func (d *PikPak) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr return err } -func (d *PikPak) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*PikPak)(nil) diff --git a/drivers/quark/driver.go b/drivers/quark/driver.go index dd5b286e1af..abae1707322 100644 --- a/drivers/quark/driver.go +++ b/drivers/quark/driver.go @@ -215,8 +215,4 @@ func (d *Quark) Put(ctx context.Context, dstDir model.Obj, stream model.FileStre return d.upFinish(pre) } -func (d *Quark) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Quark)(nil) diff --git a/drivers/s3/driver.go b/drivers/s3/driver.go index 499a3f39bb8..e555fd00e92 100644 --- a/drivers/s3/driver.go +++ b/drivers/s3/driver.go @@ -10,7 +10,6 @@ import ( "time" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/aws/aws-sdk-go/aws/session" @@ -153,8 +152,4 @@ func (d *S3) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreame return err } -func (d *S3) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*S3)(nil) diff --git a/drivers/sftp/driver.go b/drivers/sftp/driver.go index c68e99bd5fe..91b00fc920e 100644 --- a/drivers/sftp/driver.go +++ b/drivers/sftp/driver.go @@ -99,8 +99,4 @@ func (d *SFTP) Put(ctx context.Context, dstDir model.Obj, stream model.FileStrea return err } -func (d *SFTP) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*SFTP)(nil) diff --git a/drivers/teambition/driver.go b/drivers/teambition/driver.go index f7c4892754f..9ac2a7ac5eb 100644 --- a/drivers/teambition/driver.go +++ b/drivers/teambition/driver.go @@ -7,7 +7,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/go-resty/resty/v2" @@ -156,8 +155,4 @@ func (d *Teambition) Put(ctx context.Context, dstDir model.Obj, stream model.Fil return d.finishUpload(newFile, dstDir.GetID()) } -func (d *Teambition) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Teambition)(nil) diff --git a/drivers/template/driver.go b/drivers/template/driver.go index bb008541e32..88f0f04d83e 100644 --- a/drivers/template/driver.go +++ b/drivers/template/driver.go @@ -42,10 +42,10 @@ func (d *Template) List(ctx context.Context, dir model.Obj, args model.ListArgs) return nil, errs.NotImplement } -func (d *Template) Get(ctx context.Context, path string) (model.Obj, error) { - // this is optional - return nil, errs.NotImplement -} +//func (d *Template) Get(ctx context.Context, path string) (model.Obj, error) { +// // this is optional +// return nil, errs.NotImplement +//} func (d *Template) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) { // TODO return link of file @@ -82,8 +82,8 @@ func (d *Template) Put(ctx context.Context, dstDir model.Obj, stream model.FileS return errs.NotImplement } -func (d *Template) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} +//func (d *Template) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { +// return nil, errs.NotSupport +//} var _ driver.Driver = (*Template)(nil) diff --git a/drivers/thunder/driver.go b/drivers/thunder/driver.go index d6b48084099..2472ff7a5e4 100644 --- a/drivers/thunder/driver.go +++ b/drivers/thunder/driver.go @@ -357,10 +357,6 @@ func (xc *XunLeiCommon) Put(ctx context.Context, dstDir model.Obj, stream model. return nil } -func (xc *XunLeiCommon) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - func (xc *XunLeiCommon) getFiles(ctx context.Context, folderId string) ([]model.Obj, error) { files := make([]model.Obj, 0) var pageToken string diff --git a/drivers/uss/driver.go b/drivers/uss/driver.go index e5fe406329c..1edfb62e84a 100644 --- a/drivers/uss/driver.go +++ b/drivers/uss/driver.go @@ -9,7 +9,6 @@ import ( "time" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/upyun/go-sdk/v3/upyun" @@ -140,8 +139,4 @@ func (d *USS) Put(ctx context.Context, dstDir model.Obj, stream model.FileStream }) } -func (d *USS) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*USS)(nil) diff --git a/drivers/virtual/driver.go b/drivers/virtual/driver.go index ce232dfcf75..cf78c0a8a6e 100644 --- a/drivers/virtual/driver.go +++ b/drivers/virtual/driver.go @@ -6,7 +6,6 @@ import ( "time" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/alist-org/alist/v3/pkg/utils/random" @@ -89,8 +88,4 @@ func (d *Virtual) Put(ctx context.Context, dstDir model.Obj, stream model.FileSt return nil } -func (d *Virtual) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*Virtual)(nil) diff --git a/drivers/webdav/driver.go b/drivers/webdav/driver.go index 13a3d8fea78..5aedca3d865 100644 --- a/drivers/webdav/driver.go +++ b/drivers/webdav/driver.go @@ -8,7 +8,6 @@ import ( "time" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/cron" "github.com/alist-org/alist/v3/pkg/gowebdav" @@ -123,8 +122,4 @@ func (d *WebDav) Put(ctx context.Context, dstDir model.Obj, stream model.FileStr return err } -func (d *WebDav) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*WebDav)(nil) diff --git a/drivers/yandex_disk/driver.go b/drivers/yandex_disk/driver.go index fa496011101..77f9f60f518 100644 --- a/drivers/yandex_disk/driver.go +++ b/drivers/yandex_disk/driver.go @@ -8,7 +8,6 @@ import ( "github.com/alist-org/alist/v3/drivers/base" "github.com/alist-org/alist/v3/internal/driver" - "github.com/alist-org/alist/v3/internal/errs" "github.com/alist-org/alist/v3/internal/model" "github.com/alist-org/alist/v3/pkg/utils" "github.com/go-resty/resty/v2" @@ -139,8 +138,4 @@ func (d *YandexDisk) Put(ctx context.Context, dstDir model.Obj, stream model.Fil return err } -func (d *YandexDisk) Other(ctx context.Context, args model.OtherArgs) (interface{}, error) { - return nil, errs.NotSupport -} - var _ driver.Driver = (*YandexDisk)(nil) diff --git a/internal/driver/driver.go b/internal/driver/driver.go index 58547412757..933ee1b55ea 100644 --- a/internal/driver/driver.go +++ b/internal/driver/driver.go @@ -10,7 +10,7 @@ type Driver interface { Meta Reader Writer - Other + //Other } type Meta interface { diff --git a/internal/op/fs.go b/internal/op/fs.go index 117258ad073..4e772b47777 100644 --- a/internal/op/fs.go +++ b/internal/op/fs.go @@ -166,11 +166,15 @@ func Other(ctx context.Context, storage driver.Driver, args model.FsOtherArgs) ( if err != nil { return nil, errors.WithMessagef(err, "failed to get obj") } - return storage.Other(ctx, model.OtherArgs{ - Obj: obj, - Method: args.Method, - Data: args.Data, - }) + if o, ok := storage.(driver.Other); ok { + return o.Other(ctx, model.OtherArgs{ + Obj: obj, + Method: args.Method, + Data: args.Data, + }) + } else { + return nil, errs.NotImplement + } } func MakeDir(ctx context.Context, storage driver.Driver, path string) error {