MCPcopy
hub / github.com/AlistGo/alist / Get

Method Get

drivers/alias/driver.go:62–82  ·  view source on GitHub ↗
(ctx context.Context, path string)

Source from the content-addressed store, hash-verified

60}
61
62func (d *Alias) Get(ctx context.Context, path string) (model.Obj, error) {
63 if utils.PathEqual(path, "/") {
64 return &model.Object{
65 Name: "Root",
66 IsFolder: true,
67 Path: "/",
68 }, nil
69 }
70 root, sub := d.getRootAndPath(path)
71 dsts, ok := d.pathMap[root]
72 if !ok {
73 return nil, errs.ObjectNotFound
74 }
75 for _, dst := range dsts {
76 obj, err := d.get(ctx, path, dst, sub)
77 if err == nil {
78 return obj, nil
79 }
80 }
81 return nil, errs.ObjectNotFound
82}
83
84func (d *Alias) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
85 path := dir.GetPath()

Callers

nothing calls this directly

Calls 3

getRootAndPathMethod · 0.95
getMethod · 0.95
PathEqualFunction · 0.92

Tested by

no test coverage detected