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

object_store/gcp: do not double-percent-encode object paths #7147

Closed
wants to merge 1 commit 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
8 changes: 3 additions & 5 deletions object_store/src/gcp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use hyper::header::{
CACHE_CONTROL, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH,
CONTENT_TYPE,
};
use percent_encoding::{percent_encode, utf8_percent_encode, NON_ALPHANUMERIC};
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
use reqwest::header::HeaderName;
use reqwest::{Client, Method, RequestBuilder, Response, StatusCode};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -353,10 +353,9 @@ impl GoogleCloudStorageClient {
}

pub(crate) fn object_url(&self, path: &Path) -> String {
let encoded = utf8_percent_encode(path.as_ref(), NON_ALPHANUMERIC);
format!(
"{}/{}/{}",
self.config.base_url, self.bucket_name_encoded, encoded
self.config.base_url, self.bucket_name_encoded, path,
)
}

Expand Down Expand Up @@ -556,8 +555,7 @@ impl GoogleCloudStorageClient {
let credential = self.get_credential().await?;
let url = self.object_url(to);

let from = utf8_percent_encode(from.as_ref(), NON_ALPHANUMERIC);
let source = format!("{}/{}", self.bucket_name_encoded, from);
let source = format!("{}/{}", self.bucket_name_encoded, from.as_ref());

let mut builder = self
.client
Expand Down
Loading