From 56d61895f500f41fe4576a2a212166baff4b6936 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 23 May 2023 20:15:08 -0400 Subject: [PATCH] refactor: pass id to FileInfo and use info in fileUpload --- tusstore/store.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tusstore/store.go b/tusstore/store.go index 6a8abf3..8455831 100644 --- a/tusstore/store.go +++ b/tusstore/store.go @@ -77,12 +77,12 @@ func (store DbFileStore) NewUpload(ctx context.Context, info handler.FileInfo) ( } func (store DbFileStore) GetUpload(ctx context.Context, id string) (handler.Upload, error) { - info := handler.FileInfo{} - - fUpload := &fileUpload{ - info: info, + info := handler.FileInfo{ + ID: id, } + fUpload := &fileUpload{info: info} + record, is404, err := fUpload.getInfo() if err != nil { if is404 { @@ -96,6 +96,8 @@ func (store DbFileStore) GetUpload(ctx context.Context, id string) (handler.Uplo return nil, err } + fUpload.info = info + fUpload.hash = record.Hash binPath := store.binPath(id) stat, err := os.Stat(binPath)