Skip to content

Commit fa8a439

Browse files
authored
Merge pull request JanKaul#159 from splitgraph/gcs_gs
Add support for `s3a` and `gs` prefixes in `Bucket::from_path`
2 parents 3a4e01d + f42811c commit fa8a439

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • iceberg-rust/src/object_store

iceberg-rust/src/object_store/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ impl Display for Bucket<'_> {
4040
impl Bucket<'_> {
4141
/// Get the bucket and coud provider from the location string
4242
pub fn from_path(path: &str) -> Result<Bucket, Error> {
43-
if path.starts_with("s3://") {
44-
path.trim_start_matches("s3://")
43+
if path.starts_with("s3://") || path.starts_with("s3a://") {
44+
let prefix = if path.starts_with("s3://") { "s3://" } else { "s3a://" };
45+
path.trim_start_matches(prefix)
4546
.split('/')
4647
.next()
4748
.map(Bucket::S3)
4849
.ok_or(Error::NotFound(format!("Bucket in path {path}")))
49-
} else if path.starts_with("gcs://") {
50-
path.trim_start_matches("gcs://")
50+
} else if path.starts_with("gcs://") || path.starts_with("gs://") {
51+
let prefix = if path.starts_with("gcs://") { "gcs://" } else { "gs://" };
52+
path.trim_start_matches(prefix)
5153
.split('/')
5254
.next()
5355
.map(Bucket::GCS)

0 commit comments

Comments
 (0)