1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-05 09:55:20 +02:00
forgejo/routers/api/v1
oliverpool 7ad20a2730 git/blob: GetContentBase64 with fewer allocations and no goroutine (#8297)
See #8222 for context.i

`GetBlobContentBase64` was using a pipe and a goroutine to read the blob content as base64. This can be replace by a pre-allocated buffer and a direct copy.

Note that although similar to `GetBlobContent`, it does not truncate the content if the blob size is over the limit (but returns an error). I think that `GetBlobContent` should adopt the same behavior at some point (error instead of truncating).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
- [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/8297
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>
2025-06-27 11:22:10 +02:00
..
activitypub chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
admin chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
misc feat(sec): Add SSH signing support for instances (#6897) 2025-04-11 13:25:35 +00:00
notify chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
org feat: relax email requirements (#7829) 2025-05-22 12:20:25 +02:00
packages chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
repo git/blob: GetContentBase64 with fewer allocations and no goroutine (#8297) 2025-06-27 11:22:10 +02:00
settings chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
shared chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
swagger bug: unify RepoActionRun and ActionRun structs (#8250) 2025-06-23 07:54:32 +02:00
user chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
utils chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
api.go feat: API GET /repos/{owner}/{repo}/git/blobs 2025-06-13 13:52:56 +02:00