forgejo/services
vincent fb137d1e49
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.

(cherry picked from commit 35d5e4aea4bb02a0b4c7b38ecb2acf612151e891)
2024-02-26 21:42:14 +01:00
..
actions Expire artifacts before deleting them physically (#29241) 2024-02-23 09:06:14 +01:00
agit [FEAT] Check if commit is already present in target branch 2024-02-23 21:42:15 +01:00
asymkey
attachment
auth Fix c/p error in inline documentation (#29148) 2024-02-19 22:58:33 +01:00
automerge
context
convert
cron Refactor locale&string&template related code (#29165) 2024-02-16 15:20:52 +01:00
doctor
externalaccount
feed
forgejo
forms Refactor locale&string&template related code (#29165) 2024-02-16 15:20:52 +01:00
gitdiff [FEAT] Enable ambiguous character detection in configured contexts 2024-02-23 13:12:17 +01:00
indexer
issue
lfs
mailer Refactor locale&string&template related code (#29165) 2024-02-16 15:20:52 +01:00
markup
migrations
mirror
notify
org
packages Port "Use general token signing secret" 2024-02-19 20:49:37 +01:00
pull Disallow merge when required checked are missing (#29143) 2024-02-19 22:58:33 +01:00
release
repository Fix content size does not match error when uploading lfs file (#29259) 2024-02-26 21:42:14 +01:00
secrets
task
uinotification
user
webhook
wiki