Skip to content

Commit

Permalink
Fix content size does not match error when uploading lfs file
Browse files Browse the repository at this point in the history
  • Loading branch information
pulltheflower committed Feb 19, 2024
1 parent 5e72526 commit 27e5553
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions services/repository/files/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ func CreateOrUpdateFile(ctx context.Context, t *TemporaryUploadRepository, file
return err
}
if !exist {
_, err := file.ContentReader.(io.Seeker).Seek(0, io.SeekStart)
if err != nil {
return err
}
if err := contentStore.Put(lfsMetaObject.Pointer, file.ContentReader); err != nil {
if _, err2 := git_model.RemoveLFSMetaObjectByOid(ctx, repoID, lfsMetaObject.Oid); err2 != nil {
return fmt.Errorf("unable to remove failed inserted LFS object %s: %v (Prev Error: %w)", lfsMetaObject.Oid, err2, err)
Expand Down

0 comments on commit 27e5553

Please sign in to comment.