Skip to content

Commit

Permalink
allow raw s3 bucket uris
Browse files Browse the repository at this point in the history
  • Loading branch information
heuermh committed Jun 3, 2024
1 parent 449495c commit 19ebffb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/java/com/github/heuermh/cooper/Cooper.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public final class Cooper implements Callable<Integer> {
static final HumanReadableFormatter FORMATTER = new HumanReadableFormatter();

/** s3 bucket and prefix regex pattern. */
static final Pattern S3_URI = Pattern.compile("^s3:\\/\\/([a-zA-Z-]+)\\/(.+)$");
static final Pattern S3_URI = Pattern.compile("^s3:\\/\\/([a-zA-Z-]+)\\/*(.*)$");


@Override
Expand All @@ -116,10 +116,14 @@ public Integer call() throws Exception {

logger.info("valid uri={} bucket={} prefix={}", uri, bucket, prefix);

ListObjectsV2Request request = ListObjectsV2Request.builder()
.bucket(bucket)
.prefix(prefix)
.build();
ListObjectsV2Request.Builder requestBuilder = ListObjectsV2Request.builder()
.bucket(bucket);

if (prefix != null && prefix.trim().length() > 0) {
requestBuilder = requestBuilder.prefix(prefix);
}

ListObjectsV2Request request = requestBuilder.build();

logger.info("ListObjectsV2 request={}", request.toString());

Expand Down

0 comments on commit 19ebffb

Please sign in to comment.