From 1c3fb1934b49fc5dc2364755f1b0f43a9bfa45a5 Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Fri, 10 Nov 2023 00:53:17 +0800 Subject: [PATCH] Don't crash when the bucket is a non-existing file directory [#59] (#100) * Don't crash when the bucket is a non-existing file directory [#59] * fix tests --- pmtiles/bucket.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pmtiles/bucket.go b/pmtiles/bucket.go index 885a8fa..9353f92 100644 --- a/pmtiles/bucket.go +++ b/pmtiles/bucket.go @@ -113,6 +113,9 @@ func OpenBucket(ctx context.Context, bucketURL string, bucketPrefix string) (Buc return bucket, nil } else { bucket, err := blob.OpenBucket(ctx, bucketURL) + if err != nil { + return nil, err + } if bucketPrefix != "/" && bucketPrefix != "." { bucket = blob.PrefixedBucket(bucket, path.Clean(bucketPrefix)+string(os.PathSeparator)) }