Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
hesampakdaman committed Jun 1, 2024
1 parent dc42961 commit a194b5e
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion object_store/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,15 @@ impl LocalFileSystem {
path: location.as_ref()
}
);
self.config.prefix_to_filesystem(location)
let path = self.config.prefix_to_filesystem(location)?;

#[cfg(target_os = "windows")]
let path = {
let mut path = path;
PathBuf::from(path.to_string_lossy().replace(":", "%3A"))
};

Ok(path)
}
}

Expand Down Expand Up @@ -1446,6 +1454,23 @@ mod tests {
list.sort_unstable();
assert_eq!(list, vec![c, a]);
}


#[tokio::test]
#[cfg(target_os = "windows")]
async fn filesystem_filename_with_colon() {
let root = TempDir::new().unwrap();
let integration = LocalFileSystem::new_with_prefix(root.path()).unwrap();
let path = Path::parse("file%3Aname.parquet").unwrap();
let location = Path::parse("file:name.parquet").unwrap();

integration.put(&location, "test".into()).await.unwrap();
let list = flatten_list_stream(&integration, None).await.unwrap();
assert_eq!(list, vec![path.clone()]);

let result = integration.get(&location).await.unwrap().bytes().await.unwrap();
assert_eq!(result, Bytes::from("test"));
}
}

#[cfg(not(target_arch = "wasm32"))]
Expand Down

0 comments on commit a194b5e

Please sign in to comment.