]> source.dussan.org Git - gitea.git/commit
Refactor "Content" for file uploading (#25851)
authorwxiaoguang <wxiaoguang@gmail.com>
Tue, 18 Jul 2023 18:14:47 +0000 (02:14 +0800)
committerGitHub <noreply@github.com>
Tue, 18 Jul 2023 18:14:47 +0000 (18:14 +0000)
commit236c645bf16754ca9294545e71014a01a24ccfd8
tree4ca9d8f93aca854d841a7379955e9653a8212546
parent265a28802a6062d86964c9bfe1959437eaf69afb
Refactor "Content" for file uploading (#25851)

Before: the concept "Content string" is used everywhere. It has some
problems:

1. Sometimes it means "base64 encoded content", sometimes it means "raw
binary content"
2. It doesn't work with large files, eg: uploading a 1G LFS file would
make Gitea process OOM

This PR does the refactoring: use "ContentReader" / "ContentBase64"
instead of "Content"

This PR is not breaking because the key in API JSON is still "content":
`` ContentBase64 string `json:"content"` ``
15 files changed:
modules/structs/repo_file.go
routers/api/v1/repo/file.go
routers/web/repo/editor.go
services/repository/files/update.go
templates/swagger/v1_json.tmpl
tests/integration/actions_trigger_test.go
tests/integration/api_repo_file_create_test.go
tests/integration/api_repo_file_helpers.go
tests/integration/api_repo_file_update_test.go
tests/integration/api_repo_files_change_test.go
tests/integration/empty_repo_test.go
tests/integration/gpg_git_test.go
tests/integration/pull_merge_test.go
tests/integration/pull_update_test.go
tests/integration/repofiles_change_test.go