Refactor: use universal FileHeader when handling file upload, remove usage of global ctx with FileHeader, SavePath, DisableOverwrite

This commit is contained in:
HFO4
2022-02-27 14:03:07 +08:00
parent 8a222e7df4
commit 868a88e5fc
39 changed files with 331 additions and 359 deletions

View File

@@ -80,7 +80,7 @@ func TestDriver_Token(t *testing.T) {
{
ctx := context.WithValue(context.Background(), fsctx.SavePathCtx, "/123")
cache.Set("setting_siteURL", "http://test.cloudreve.org", 0)
res, err := handler.Token(ctx, 10, "key")
res, err := handler.Token(ctx, 10, "key", nil)
asserts.NoError(err)
asserts.NotEmpty(res.Policy)
asserts.NotEmpty(res.Token)
@@ -91,7 +91,7 @@ func TestDriver_Token(t *testing.T) {
// 上下文错误
{
ctx := context.Background()
_, err := handler.Token(ctx, 10, "key")
_, err := handler.Token(ctx, 10, "key", nil)
asserts.Error(err)
}