1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-23 08:47:42 -05:00
forgejo/routers/api/v1
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
..
activitypub More refactoring of db.DefaultContext (#27083) 2023-09-15 06:13:19 +00:00
admin Unify user update methods (#28733) 2024-02-04 13:29:09 +00:00
misc [BRANDING] Update nodeinfo branding 2024-02-05 16:04:50 +01:00
notify Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00
org [MODERATION] User blocking 2024-02-05 15:56:45 +01:00
packages Another round of db.DefaultContext refactor (#27103) 2023-09-25 13:17:37 +00:00
repo Fix content size does not match error when uploading lfs file (#29259) 2024-02-26 21:42:14 +01:00
settings Allow instance-wide disabling of forking 2024-02-25 12:00:17 +01:00
shared [GITEA] API comment update routers/api/v1/shared/runners.go 2024-02-05 16:09:43 +01:00
swagger Merge branch 'rebase-forgejo-dependency' into wip-forgejo 2024-02-05 18:58:23 +01:00
user Merge branch 'rebase-forgejo-dependency' into wip-forgejo 2024-02-05 18:58:23 +01:00
utils [MODERATION] User blocking 2024-02-05 15:56:45 +01:00
api.go Add API to get PR by base/head (#29242) 2024-02-26 03:41:42 +01:00