diff --git a/src/loci/formats/S3FileSystemStore.java b/src/loci/formats/S3FileSystemStore.java index cad86d6..7d66928 100644 --- a/src/loci/formats/S3FileSystemStore.java +++ b/src/loci/formats/S3FileSystemStore.java @@ -75,6 +75,7 @@ public class S3FileSystemStore implements Store { private Path root; AmazonS3 client; + public static final String ENDPPOINT_PROTOCOL= "https://"; protected static final Logger LOGGER = LoggerFactory.getLogger(S3FileSystemStore.class); @@ -97,7 +98,7 @@ public String getRoot() { private void setupClient() { String[] pathSplit = root.toString().split(File.separator); - String endpoint = "https://" + pathSplit[1] + File.separator; + String endpoint = "ENDPPOINT_PROTOCOL" + pathSplit[1] + File.separator; try { client = AmazonS3ClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, "auto")) @@ -179,7 +180,7 @@ public TreeSet getGroupKeys() throws IOException { * @throws IOException */ public TreeSet getKeysEndingWith(String suffix) throws IOException { - return (TreeSet)Files.walk(this.root).filter((path) -> { + return (TreeSet)Files.walk(this.root).filter((path) -> { return path.toString().endsWith(suffix); }).map((path) -> { return this.root.relativize(path).toString(); diff --git a/src/loci/formats/services/JZarrServiceImpl.java b/src/loci/formats/services/JZarrServiceImpl.java index 482315f..ff6b8f9 100644 --- a/src/loci/formats/services/JZarrServiceImpl.java +++ b/src/loci/formats/services/JZarrServiceImpl.java @@ -1,5 +1,7 @@ package loci.formats.services; +import java.io.File; + /*- * #%L * Implementation of Bio-Formats readers for the next-generation file formats @@ -79,7 +81,13 @@ public class JZarrServiceImpl extends AbstractService public JZarrServiceImpl(String root) { checkClassDependency(com.bc.zarr.ZarrArray.class); if (root != null && (root.toLowerCase().contains("s3:") || root.toLowerCase().contains("s3."))) { - s3fs = new S3FileSystemStore(Paths.get(root)); + String[] pathSplit = root.toString().split(File.separator); + if (!S3FileSystemStore.ENDPPOINT_PROTOCOL.contains(pathSplit[0].toLowerCase())) { + s3fs = new S3FileSystemStore(Paths.get(root)); + } + else { + LOGGER.warn("Zarr Reader is not using S3FileSystemStore as this is currently for use with S3 configured with a https endpoint"); + } } } @@ -89,7 +97,7 @@ public void open(String file) throws IOException, FormatException { if (s3fs == null) { zarrArray = ZarrArray.open(file); } - else { + else { s3fs.updateRoot(getZarrRoot(s3fs.getRoot()) + stripZarrRoot(file)); zarrArray = ZarrArray.open(s3fs); }