You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/services/repository/files
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 \"05904d6c7b16bb9b29587100ab1414\": 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.
12 months ago
..
cherry_pick.go Fix reverting a merge commit failing (#28794) 1 year ago
commit.go Simplify how git repositories are opened (#28937) 1 year ago
content.go Extract linguist code to method (#29168) 12 months ago
content_test.go Simplify how git repositories are opened (#28937) 1 year ago
diff.go Fix reverting a merge commit failing (#28794) 1 year ago
diff_test.go Move web/api context related testing function into a separate package (#26859) 1 year ago
file.go API endpoint for changing/creating/deleting multiple files (#24887) 2 years ago
file_test.go Simplify how git repositories are opened (#28937) 1 year ago
patch.go Simplify how git repositories are opened (#28937) 1 year ago
temp_repo.go Fix reverting a merge commit failing (#28794) 1 year ago
tree.go Abstract hash function usage (#28138) 1 year ago
tree_test.go Move web/api context related testing function into a separate package (#26859) 1 year ago
update.go Fix content size does not match error when uploading lfs file (#29259) 12 months ago
upload.go Fix reverting a merge commit failing (#28794) 1 year ago