githaven-fork/routers
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
..
api Fix content size does not match error when uploading lfs file (#29259) 2024-02-19 14:50:03 +00:00
common Rework markup link rendering (#26745) 2024-01-15 08:49:24 +00:00
install Refactor JWT secret generating & decoding code (#29172) 2024-02-16 15:18:30 +00:00
private Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
utils Improve user search display name (#29002) 2024-02-01 17:10:16 +00:00
web Deduplicate translations for contributors graph (#29256) 2024-02-19 12:47:38 +00:00
init.go Allow to sync tags from admin dashboard (#28045) 2024-01-24 03:02:04 +00:00