paleolimbot commented on code in PR #283:
URL: https://github.com/apache/sedona-db/pull/283#discussion_r2542531039
##########
rust/sedona-datasource/src/spec.rs:
##########
@@ -182,16 +187,145 @@ impl Object {
// GDAL to be able to translate.
let object_store_debug = format!("{:?}",
self.store).to_lowercase();
if object_store_debug.contains("http") {
- Some(format!("https://{}", meta.location))
- } else if object_store_debug.contains("local") {
+ let pattern = r#"host:
some\(domain\("([A-Za-z0-9.-]+)"\)\)"#;
+ let re = Regex::new(pattern).ok()?;
+ if let Some(caps) = re.captures(&object_store_debug) {
+ caps.get(1)
+ .map(|host| format!("https://{}/{}",
host.as_str(), meta.location))
+ } else {
+ None
+ }
+ } else if object_store_debug.contains("localfilesystem") {
Some(format!("file:///{}", meta.location))
} else {
None
}
}
- (Some(url), None) => Some(url.to_string()),
- (Some(url), Some(meta)) => Some(format!("{url}/{}",
meta.location)),
- (None, None) => None,
+ (Some(url), Some(meta)) => Some(format!("{url}{}", meta.location)),
Review Comment:
This is tested and as far as I can tell shouldn't have a path separator when
it generates the url like this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]