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

fix(storage): respect STORAGE_EMULATOR_HOST in signedURL #5411

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ type bucketBoundHostname struct {
}

func (s pathStyle) host(bucket string) string {
return "storage.googleapis.com"
if os.Getenv("STORAGE_EMULATOR_HOST") {
return os.Getenv("STORAGE_EMULATOR_HOST")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We accept STORAGE_EMULATOR_HOST both with and without a scheme, so we should strip the scheme if it is present. See https://github.com/googleapis/google-cloud-go/blob/main/storage/storage.go#L154

} else {
return "storage.googleapis.com"
}
}

func (s virtualHostedStyle) host(bucket string) string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path for virtual hosted should be updated as well probably?

Expand Down