0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-02-20 20:05:32 +01:00
gitea/routers/api/v1/repo
Zettat123 0690cb076b
Fix missing signature key error when pulling Docker images with SERVE_DIRECT enabled (#32365)
Fix #28121

I did some tests and found that the `missing signature key` error is
caused by an incorrect `Content-Type` header. Gitea correctly sets the
`Content-Type` header when serving files.

348d1d0f32/routers/api/packages/container/container.go (L712-L717)
However, when `SERVE_DIRECT` is enabled, the `Content-Type` header may
be set to an incorrect value by the storage service. To fix this issue,
we can use query parameters to override response header values.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
<img width="600px"
src="https://github.com/user-attachments/assets/f2ff90f0-f1df-46f9-9680-b8120222c555"
/>

In this PR, I introduced a new parameter to the `URL` method to support
additional parameters.

```
URL(path, name string, reqParams url.Values) (*url.URL, error)
```

---

Most S3-like services support specifying the content type when storing
objects. However, Gitea always use `application/octet-stream`.
Therefore, I believe we also need to improve the `Save` method to
support storing objects with the correct content type.

b7fb20e73e/modules/storage/minio.go (L214-L221)
2024-10-31 15:28:25 +00:00
..
action.go Set owner id to zero when GetRegistrationToken for repo (#31725) 2024-07-29 18:46:45 +00:00
avatar.go
blob.go
branch.go Make admins adhere to branch protection rules (#32248) 2024-10-23 12:39:43 +08:00
collaborators.go
commits.go Fix bug in getting merged pull request by commit (#32079) 2024-09-24 01:00:09 +00:00
compare.go
file.go Fix missing signature key error when pulling Docker images with SERVE_DIRECT enabled (#32365) 2024-10-31 15:28:25 +00:00
fork.go
git_hook.go
git_ref.go
hook_test.go
hook.go
issue_attachment.go
issue_comment_attachment.go
issue_comment.go
issue_dependency.go
issue_label.go
issue_pin.go
issue_reaction.go
issue_stopwatch.go
issue_subscription.go
issue_tracked_time.go
issue.go API: enhance SearchIssues swagger docs (#32208) 2024-10-19 20:11:56 +00:00
key.go
label.go
language.go
license.go Support repo license (#24872) 2024-10-01 15:25:08 -04:00
main_test.go
migrate.go Support migration from AWS CodeCommit (#31981) 2024-09-11 07:49:42 +08:00
milestone.go
mirror.go
notes.go
patch.go
pull_review.go Fix the logic of finding the latest pull review commit ID (#32139) 2024-10-01 01:58:55 +00:00
pull.go Allow filtering PRs by poster in the ListPullRequests API (#32209) 2024-10-07 23:21:07 +02:00
release_attachment.go
release_tags.go
release.go Handle invalid target when creating releases using API (#31841) 2024-09-12 07:47:31 +00:00
repo_test.go
repo.go refactor: remove redundant err declarations (#32381) 2024-10-30 19:36:24 +00:00
star.go
status.go
subscriber.go
tag.go
teams.go
topic.go
transfer.go
tree.go
wiki.go