chore: optional get func for driver
This commit is contained in:
@ -35,7 +35,10 @@ type Reader interface {
|
||||
List(ctx context.Context, dir model.Obj) ([]model.Obj, error)
|
||||
// Link get url/filepath/reader of file
|
||||
Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)
|
||||
//Get(ctx context.Context, path string) (FileInfo, error) // maybe not need
|
||||
}
|
||||
|
||||
type Getter interface {
|
||||
Get(ctx context.Context, path string) (model.Obj, error)
|
||||
}
|
||||
|
||||
type Writer interface {
|
||||
|
@ -71,6 +71,9 @@ func isRoot(path, rootFolderPath string) bool {
|
||||
func Get(ctx context.Context, account driver.Driver, path string) (model.Obj, error) {
|
||||
path = utils.StandardizePath(path)
|
||||
log.Debugf("operations.Get %s", path)
|
||||
if g, ok := account.(driver.Getter); ok {
|
||||
return g.Get(ctx, path)
|
||||
}
|
||||
// is root folder
|
||||
if r, ok := account.GetAddition().(driver.IRootFolderId); ok && utils.PathEqual(path, "/") {
|
||||
return model.Object{
|
||||
|
Reference in New Issue
Block a user