feat: pin file after tus upload

This commit is contained in:
Derrick Hammer 2023-06-09 07:04:52 -04:00
parent 8692a0225e
commit 5579ab85a3
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -166,7 +166,7 @@ func tusWorker(upload *tusd.Upload) error {
return err
}
_, err = files.Upload(file.(io.ReadSeeker), info.Size, hashBytes)
newUpload, err := files.Upload(file.(io.ReadSeeker), info.Size, hashBytes)
tErr := terminateUpload(*upload)
if tErr != nil {
@ -177,6 +177,11 @@ func tusWorker(upload *tusd.Upload) error {
return err
}
err = files.Pin(newUpload.Hash, newUpload.AccountID)
if err != nil {
return err
}
return nil
}