fix: if we have an existing upload, just return it as if successful

This commit is contained in:
Derrick Hammer 2023-05-22 11:02:47 -04:00
parent ed6220fc7d
commit 90170e5b81
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 0 deletions

View File

@ -58,6 +58,11 @@ func Upload(r io.ReadSeeker, size int64, hash []byte) (model.Upload, error) {
shared.GetLogger().Error("Failed to query uploads table", zap.Error(err))
return upload, err
}
if result.RowsAffected > 0 && upload.ID > 0 {
shared.GetLogger().Info("Upload already exists")
return upload, nil
}
}
objectExistsResult, err := client.R().Get(fmt.Sprintf("/worker/objects/%s", hashHex))