0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-22 12:15:34 +01:00
gitea/services/repository
vincent 35d5e4aea4
Fix content size does not match error when uploading lfs file (#29259)
![image](https://github.com/go-gitea/gitea/assets/38434877/cd726b4d-4771-4547-8aee-ae4e4b56b1d1)
When we update an lfs file by API
`api/v1/repos/{owner}/{repo}/contents/{filepath}`, there will show an
error

```json
{
  "message": "Put \"05904d6c7b\": readfrom tcp [::1]:57300->[::1]:9000: content size does not match",
  "url": "http://localhost:3000/api/swagger"
}
```

The reason of this error is
https://github.com/go-gitea/gitea/blob/main/services/repository/files/update.go,
in this file, the `file.ContentReader` been used twice. So when use
`file.ContentReader` in the second time, the `i` of this Reader has been
updated to the length of the content. it will return 0 and an `io.EOF`
error when we try to read cotent from this Reader.
2024-02-19 14:50:03 +00:00
..
archiver Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
files Fix content size does not match error when uploading lfs file (#29259) 2024-02-19 14:50:03 +00:00
adopt_test.go
adopt.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
avatar_test.go
avatar.go
branch.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
cache.go
check.go Update tool dependencies (#29030) 2024-02-02 19:11:39 -05:00
collaboration_test.go
collaboration.go
commit.go
contributors_graph_test.go Implement contributors graph (#27882) 2024-02-15 23:21:13 +01:00
contributors_graph.go Implement contributors graph (#27882) 2024-02-15 23:21:13 +01:00
create_test.go bump to use go 1.22 (#29119) 2024-02-14 18:19:57 +00:00
create.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
delete_test.go
delete.go
fork_test.go
fork.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
hooks.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
lfs_test.go
lfs.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
main_test.go
push.go Do not use lower tag names to find releases/tags (#29261) 2024-02-19 09:31:36 +00:00
repository_test.go
repository.go
review_test.go
review.go
setting.go Fix an actions schedule bug (#28942) 2024-01-31 14:55:12 +00:00
template.go
transfer_test.go Move some repository transfer functions to service layer (#28855) 2024-02-05 06:17:23 +00:00
transfer.go Move some repository transfer functions to service layer (#28855) 2024-02-05 06:17:23 +00:00