Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions icechunk/src/virtual_chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ impl VirtualChunkResolver {
&self,
chunk_location: &Url,
) -> Result<Arc<dyn ChunkFetcher>, VirtualReferenceError> {
let cont = self
.matching_container(chunk_location.to_string().as_str())
.ok_or_else(|| {
VirtualReferenceErrorKind::NoContainerForUrl(chunk_location.to_string())
})?;
let location = chunk_location.to_string();
let location = urlencoding::decode(location.as_str())?;
let cont = self.matching_container(location.as_ref()).ok_or_else(|| {
VirtualReferenceErrorKind::NoContainerForUrl(chunk_location.to_string())
})?;

let cache_key = fetcher_cache_key(cont, chunk_location)?;
// TODO: we shouldn't need to clone the container name
Expand Down Expand Up @@ -416,7 +416,7 @@ impl VirtualChunkResolver {
};

let bucket_name = if let Some(host) = chunk_location.host_str() {
host.to_string()
urlencoding::decode(host)?.into_owned()
} else {
Err(VirtualReferenceErrorKind::CannotParseBucketName(
"No bucket name found".to_string(),
Expand Down Expand Up @@ -475,7 +475,7 @@ impl VirtualChunkResolver {
};

let container = if let Some(host) = chunk_location.host_str() {
host.to_string()
urlencoding::decode(host)?.into_owned()
} else {
Err(VirtualReferenceErrorKind::CannotParseBucketName(
"No bucket name found".to_string(),
Expand Down Expand Up @@ -566,7 +566,7 @@ impl ChunkFetcher for S3Fetcher {
checksum: Option<&Checksum>,
) -> Result<Box<dyn Buf + Unpin + Send>, VirtualReferenceError> {
let bucket_name = if let Some(host) = chunk_location.host_str() {
host.to_string()
urlencoding::decode(host)?.into_owned()
} else {
Err(VirtualReferenceErrorKind::CannotParseBucketName(
"No bucket name found".to_string(),
Expand Down
22 changes: 22 additions & 0 deletions icechunk/tests/test_virtual_refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@ async fn create_minio_repository() -> Repository {
}),
)
.unwrap(),
VirtualChunkContainer::new(
"s3://testbucket/path with spaces/".to_string(),
ObjectStoreConfig::S3Compatible(S3Options {
region: Some(String::from("us-east-1")),
endpoint_url: Some("http://localhost:9000".to_string()),
anonymous: false,
allow_http: true,
force_path_style: true,
network_stream_timeout_seconds: None,
requester_pays: false,
}),
)
.unwrap(),
VirtualChunkContainer::new(
"az://testcontainer/".to_string(),
ObjectStoreConfig::Azure(HashMap::from([
Expand All @@ -229,6 +242,15 @@ async fn create_minio_repository() -> Repository {
expires_after: None,
}))),
),
(
"s3://testbucket/path with spaces/".to_string(),
Some(Credentials::S3(S3Credentials::Static(S3StaticCredentials {
access_key_id: "minio123".to_string(),
secret_access_key: "minio123".to_string(),
session_token: None,
expires_after: None,
}))),
),
(
"az://testcontainer/".to_string(),
Some(Credentials::Azure(AzureCredentials::FromEnv)),
Expand Down