1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00

blob: permit skipping the configuration of the Content-Disposition header (#4832)

This change would allow users to disable the `Content-Disposition`
header that is set for blob storage operations. The application will
continue to set a default value for `Content-Disposition` of
`attachment; filename={{.Filename}}` if no value was provided by the
user. However, with this change, users can now specifically disable this
header by setting the value to "-" in the configuration.

We feel this would be a nice solution for this issue:
https://github.com/Homebrew/brew/issues/15604
This commit is contained in:
Maxime VISONNEAU 2024-05-10 03:13:46 +02:00 committed by GitHub
parent 5d98c69f0f
commit 3c0c7148fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View File

@ -33,9 +33,13 @@ func (Pipe) Default(ctx *context.Context) error {
if blob.Directory == "" {
blob.Directory = "{{ .ProjectName }}/{{ .Tag }}"
}
if blob.ContentDisposition == "" {
blob.ContentDisposition = "attachment;filename={{.Filename}}"
} else if blob.ContentDisposition == "-" {
blob.ContentDisposition = ""
}
if blob.OldDisableSSL {
deprecate.Notice(ctx, "blobs.disableSSL")
blob.DisableSSL = true

View File

@ -75,8 +75,9 @@ func TestDefaults(t *testing.T) {
ContentDisposition: "inline",
},
{
Bucket: "foobar",
Provider: "gcs",
Bucket: "foobar",
Provider: "gcs",
ContentDisposition: "-",
},
{
Bucket: "deprecated",
@ -100,7 +101,7 @@ func TestDefaults(t *testing.T) {
Bucket: "foobar",
Provider: "gcs",
Directory: "{{ .ProjectName }}/{{ .Tag }}",
ContentDisposition: "attachment;filename={{.Filename}}",
ContentDisposition: "",
},
{
Bucket: "deprecated",

View File

@ -116,6 +116,7 @@ blobs:
# Since: v1.24
# Default: attachment;filename={{.Filename}}
# Templates: allowed
# Disable by setting the value to '-'
content_disposition: "inline"
- provider: gs