0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-23 15:53:07 -05:00
forgejo/services/repository/files
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
..
cherry_pick.go Fix reverting a merge commit failing (#28794) 2024-01-16 15:06:51 +00:00
commit.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
content.go Extract linguist code to method (#29168) 2024-02-16 15:20:52 +01:00
content_test.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
diff.go Fix reverting a merge commit failing (#28794) 2024-01-16 15:06:51 +00:00
diff_test.go [BUG] split code conversations in diff tab (#2306) 2024-02-16 12:16:11 +00:00
file.go [GITEA] Allow user to select email for file operations in Web UI 2024-02-05 16:09:41 +01:00
file_test.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
patch.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
search.go [FEAT] add fallback repo search using git grep 2024-02-20 13:00:34 +00:00
search_test.go [FEAT] add fallback repo search using git grep 2024-02-20 13:00:34 +00:00
temp_repo.go Fix reverting a merge commit failing (#28794) 2024-01-16 15:06:51 +00:00
tree.go Abstract hash function usage (#28138) 2023-12-13 21:02:00 +00:00
tree_test.go
update.go Fix content size does not match error when uploading lfs file (#29259) 2024-02-26 21:42:14 +01:00
upload.go Fix reverting a merge commit failing (#28794) 2024-01-16 15:06:51 +00:00