0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-24 05:16:17 +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 Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
blob.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
branch.go Make admins adhere to branch protection rules (#32248) 2024-10-23 12:39:43 +08:00
collaborators.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
commits.go Fix bug in getting merged pull request by commit (#32079) 2024-09-24 01:00:09 +00:00
compare.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
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 Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
git_hook.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
git_ref.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
hook_test.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
hook.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_attachment.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_comment_attachment.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_comment.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_dependency.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_label.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_pin.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_reaction.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_stopwatch.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_subscription.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_tracked_time.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue.go API: enhance SearchIssues swagger docs (#32208) 2024-10-19 20:11:56 +00:00
key.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
label.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
language.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
license.go Support repo license (#24872) 2024-10-01 15:25:08 -04:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
migrate.go Support migration from AWS CodeCommit (#31981) 2024-09-11 07:49:42 +08:00
milestone.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
mirror.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
notes.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
patch.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
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 Refactor names (#31405) 2024-06-19 06:32:45 +08:00
release_tags.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
release.go Handle invalid target when creating releases using API (#31841) 2024-09-12 07:47:31 +00:00
repo_test.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
repo.go refactor: remove redundant err declarations (#32381) 2024-10-30 19:36:24 +00:00
star.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
status.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
subscriber.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
tag.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
teams.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
topic.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
transfer.go Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
tree.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
wiki.go Enable more revive linter rules (#30608) 2024-04-22 11:48:42 +00:00