Skip to content

Commit

Permalink
gcp: Exclude authorization header when bearer empty (#4418)
Browse files Browse the repository at this point in the history
GCP tries to authorize when there's the authorization header. If the
bearer is empty, exclude the header since this doesn't let us get a
public object.

Signed-off-by: Vaibhav <[email protected]>
  • Loading branch information
vrongmeal authored Jun 20, 2023
1 parent c41dc7f commit 0bcf200
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions object_store/src/gcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,19 @@ impl GetClient for GoogleCloudStorageClient {
false => Method::GET,
};

let response = self
.client
.request(method, url)
.bearer_auth(&credential.bearer)
.with_get_options(options)
.send_retry(&self.retry_config)
.await
.context(GetRequestSnafu {
path: path.as_ref(),
})?;
let mut request = self.client.request(method, url).with_get_options(options);

if !credential.bearer.is_empty() {
request = request.bearer_auth(&credential.bearer);
}

let response =
request
.send_retry(&self.retry_config)
.await
.context(GetRequestSnafu {
path: path.as_ref(),
})?;

Ok(response)
}
Expand Down

0 comments on commit 0bcf200

Please sign in to comment.