Skip to content

Commit

Permalink
fix: N5URI.from
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Apr 25, 2024
1 parent 72054c4 commit d1dfc8e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/org/janelia/saalfeldlab/n5/N5URI.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,11 @@ public static N5URI from(
*/
public static N5URI from(final String uriOrPath) {

URI uri;
URI uri = null;
try {
uri = new URI(uriOrPath);
System.out.println("parsed as uri");
System.out.println("direct uri: " + uri.toString());
return new N5URI(uri);
} catch (Throwable ignore) {}

try {
Expand All @@ -615,22 +616,23 @@ public static N5URI from(final String uriOrPath) {
else {
StringBuffer buildUri = new StringBuffer();
buildUri.append(tmp.toString());
buildUri.append("?");
for (int i = 1; i < split.length; i++)
buildUri.append(split[i]);

uri = new URI(buildUri.toString());
System.out.println("path uri: " + uri.toString());
return new N5URI(uri);
}
} catch (Throwable ignore) {}

try {
uri = N5URI.encodeAsUri(uriOrPath);
System.out.println("encoded uri: " + uri.toString());
return new N5URI(N5URI.encodeAsUri(uriOrPath));
} catch (URISyntaxException e) {
throw new N5Exception(e);
}

return new N5URI(uri);
}

/**
Expand Down

0 comments on commit d1dfc8e

Please sign in to comment.