chore: standardize context keys with custom ContextKey type (#697)

* chore: standardize context keys with custom ContextKey type

* fix bug

* 使用Request.Context
This commit is contained in:
j2rong4cn
2025-07-14 23:55:17 +08:00
committed by GitHub
parent 2a4c546a8b
commit 0c461991f9
51 changed files with 253 additions and 219 deletions

View File

@ -45,7 +45,7 @@ func getBucketByName(name string) (Bucket, error) {
func getDirEntries(path string) ([]model.Obj, error) {
ctx := context.Background()
meta, _ := op.GetNearestMeta(path)
fi, err := fs.Get(context.WithValue(ctx, "meta", meta), path, &fs.GetArgs{})
fi, err := fs.Get(context.WithValue(ctx, conf.MetaKey, meta), path, &fs.GetArgs{})
if errs.IsNotFoundError(err) {
return nil, gofakes3.ErrNoSuchKey
} else if err != nil {
@ -56,7 +56,7 @@ func getDirEntries(path string) ([]model.Obj, error) {
return nil, gofakes3.ErrNoSuchKey
}
dirEntries, err := fs.List(context.WithValue(ctx, "meta", meta), path, &fs.ListArgs{})
dirEntries, err := fs.List(context.WithValue(ctx, conf.MetaKey, meta), path, &fs.ListArgs{})
if err != nil {
return nil, err
}