Originally created by @bioball on GitHub (Aug 6, 2024).
Pkl currently hard-fails if given a file: URI with a host set.
For example:
pkl eval file://example.com/bar/baz.pkl
Produces:
An unexpected error has occurred. Would you mind filing a bug report?
We should either support remote files, or throw a meaningful error here.
Originally created by @bioball on GitHub (Aug 6, 2024).
Pkl currently hard-fails if given a `file:` URI with a host set.
For example:
```
pkl eval file://example.com/bar/baz.pkl
```
Produces:
```
An unexpected error has occurred. Would you mind filing a bug report?
```
We should either support remote files, or throw a meaningful error here.
adam
added the bug label 2025-12-30 01:21:59 +01:00
@bioball Hi, may I try to fix the bug? I will change the code to like below
publicstaticURLtoUrl(URIuri)throwsIOException{try{if("file".equalsIgnoreCase(uri.getScheme())&&uri.getHost()!=null){thrownewUnsupportedOperationException("Remote file URIs are not supported: "+uri);}returnuri.toURL();}catch(Errore){// best we can do for now// rely on caller to provide context, e.g., the requested module URIif(e.getClass().getName().equals("com.oracle.svm.core.jdk.UnsupportedFeatureError")){thrownewIOException("Unsupported protocol: "+uri.getScheme());}throwe;}}
If assign the bug to me, I will try my best to support remote files by download the file or other ways.
@Carpe-Wang commented on GitHub (Aug 18, 2024):
@bioball Hi, may I try to fix the bug? I will change the code to like below
```java
public static URL toUrl(URI uri) throws IOException {
try {
if ("file".equalsIgnoreCase(uri.getScheme()) && uri.getHost() != null) {
throw new UnsupportedOperationException("Remote file URIs are not supported: " + uri);
}
return uri.toURL();
} catch (Error e) {
// best we can do for now
// rely on caller to provide context, e.g., the requested module URI
if (e.getClass().getName().equals("com.oracle.svm.core.jdk.UnsupportedFeatureError")) {
throw new IOException("Unsupported protocol: " + uri.getScheme());
}
throw e;
}
}
```
If assign the bug to me, I will try my best to support remote files by download the file or other ways.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @bioball on GitHub (Aug 6, 2024).
Pkl currently hard-fails if given a
file:URI with a host set.For example:
Produces:
We should either support remote files, or throw a meaningful error here.
@Carpe-Wang commented on GitHub (Aug 18, 2024):
@bioball Hi, may I try to fix the bug? I will change the code to like below
If assign the bug to me, I will try my best to support remote files by download the file or other ways.