Closed pmlopes closed 4 years ago
Thanks for the report! Should be fixed by https://github.com/graalvm/graaljs/commit/b978c76b59cc9fc90e30cd6599c21f6e1ab35b5e
@pmlopes Did you have to implement a custom file system that supports https to get this to work?
Hi, not yet, it's on my to-do list. I do have a custom filesystem but this method wasn't working. So I still need to implement it now
OK, no worries. There's some discussion in the issue linked above.
@eleinadani This still doesn't seem to work in 20.2 despite your fix. com.oracle.truffle.js.runtime.objects.DefaultESModuleLoader#resolveImportedModule
refuses to try and parse the path as a URI and instead calls resolveSibling()
.
This is with a custom FS and URI scheme.
Error in script "": java.nio.file.InvalidPathException: Illegal char <:> at index 9: filestore://public/nashorn_import.js
org.graalvm.polyglot.PolyglotException: java.nio.file.InvalidPathException: Illegal char <:> at index 9: filestore://public/nashorn_import.js
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
at java.base/java.nio.file.Path.resolveSibling(Path.java:574)
at com.oracle.truffle.api.TruffleFile.resolveSibling(TruffleFile.java:595)
at com.oracle.truffle.js.runtime.objects.DefaultESModuleLoader.resolveImportedModule(DefaultESModuleLoader.java:98)
I think your tests work because the source is not a file?
consider the following script:
When using a custom
FileSystem
the module string path will be passed to the API method:Instead of:
As URIs are valid for module locations the correct
FileSystem
method should be invoked. Also the API contract states thatparsePath(String)
should be invoked for resources with schemafile
which isn't the case in this example.