Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor "Content" for file uploading #25851

Merged
merged 4 commits into from
Jul 18, 2023

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Jul 12, 2023

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"`

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 12, 2023
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 12, 2023
@wxiaoguang wxiaoguang added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Jul 12, 2023
@wxiaoguang wxiaoguang added this to the 1.21.0 milestone Jul 12, 2023
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 12, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 16, 2023
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jul 18, 2023
@silverwind silverwind enabled auto-merge (squash) July 18, 2023 16:46
@silverwind silverwind merged commit 236c645 into go-gitea:main Jul 18, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jul 18, 2023
@wxiaoguang wxiaoguang deleted the fix-api-file-content branch July 18, 2023 19:20
silverwind added a commit to silverwind/gitea that referenced this pull request Jul 18, 2023
* main:
  Refactor "Content" for file uploading (go-gitea#25851)
  Fix SSPI auth panic (go-gitea#25955)
  Make pending commit status yellow again (go-gitea#25935)
  Move public asset files to the proper directory (go-gitea#25907)
  Disallow dangerous url schemes (go-gitea#25960)
  Avoid creating directories when loading config (go-gitea#25944)
  [skip ci] Updated translations via Crowdin
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 20, 2023
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Fix commit status color on dashboard repolist (go-gitea#25993)
  Improve profile readme rendering (go-gitea#25988)
  avoid hard-coding height in language dropdown menu (go-gitea#25986)
  parseScope with owner/repo always sets owner to zero (go-gitea#25987)
  Bump github.com/golang-jwt/jwt to v5 (go-gitea#25975)
  Update path related documents (go-gitea#25417)
  Update djlint, enable H026 and T027 (go-gitea#25980)
  [skip ci] Updated translations via Crowdin
  Show the mismatched ROOT_URL warning on the sign-in page if OAuth2 is enabled (go-gitea#25947)
  Refactor "Content" for file uploading (go-gitea#25851)
  Fix SSPI auth panic (go-gitea#25955)
  Make pending commit status yellow again (go-gitea#25935)
  Move public asset files to the proper directory (go-gitea#25907)
  Disallow dangerous url schemes (go-gitea#25960)
  Avoid creating directories when loading config (go-gitea#25944)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Oct 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants