mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-27 04:21:11 +00:00
See #8222 for context. ## git.Blob.NewTruncatedReader This introduce a new `NewTruncatedReader` method to return a blob-reader which silently truncates when the limit is reached (io.EOF will be returned). Since the actual size is also returned `GetBlobContent` can pre-allocate a `[]byte` of the full-size (min of the asked size and the actual size) and call `io.ReadFull(rc, buf)` (instead of `util.ReadWithLimit(dataRc, int(limit))` which is convoluted and not used anywhere else). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. ### Documentation - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] I do not want this change to show in the release notes. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8223 Reviewed-by: Lucas <sclu1034@noreply.codeberg.org> Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: oliverpool <git@olivier.pfad.fr> Co-committed-by: oliverpool <git@olivier.pfad.fr> |
||
|---|---|---|
| .. | ||
| filebuffer | ||
| rotatingfilewriter | ||
| color.go | ||
| color_test.go | ||
| error.go | ||
| file_unix.go | ||
| file_unix_test.go | ||
| io.go | ||
| keypair.go | ||
| keypair_test.go | ||
| legacy.go | ||
| legacy_test.go | ||
| pack.go | ||
| pack_test.go | ||
| paginate.go | ||
| paginate_test.go | ||
| path.go | ||
| path_test.go | ||
| remove.go | ||
| sanitize.go | ||
| sanitize_test.go | ||
| sec_to_time.go | ||
| sec_to_time_test.go | ||
| shellquote.go | ||
| shellquote_test.go | ||
| slice.go | ||
| slice_test.go | ||
| string.go | ||
| string_test.go | ||
| timer.go | ||
| timer_test.go | ||
| truncate.go | ||
| truncate_test.go | ||
| url.go | ||
| util.go | ||
| util_test.go | ||