-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File URLs should be handled as such on JVM platform #88
Comments
that's java URI syntax right? So the better way to do it would be either to write your own string mapper and use it in your KamelConfig:
Or.. the default common string mapper could be modified in the library and split into expect actual definitions, and extended to add uri support on jvm. Or is the java uri format useful on other targets as well? In that case the default common string mapper could be extended for other targets too. Lmk what you think |
Also fyi if you did instead |
The There's no I'll give the custom mapper way a try. |
Thanks for the reference.
|
Using when {
url.startsWith("file:") -> asyncPainterResource(Paths.get(URI.create(url)).toFile())
else -> asyncPainterResource(url)
} |
It might just be an issue with your path |
Ha! :) The path is right as I can load the image if I pass a |
So it appears, |
Right, the image path I use is for a png file from the OS file system, outside the application resources. |
Lol, I see now I was editing the ResourcesFetcher test... so obviously loading resources was working 😅 Anyways: you can try it with: |
@eskatos lmk if you get a chance to try it out |
I just tried and it fails by default parsing a I would understand you push this upstream to KTor at this point. |
If that's common I can add a case here: kamel-core/src/commonMain/kotlin/io/kamel/core/mapper/Mappers.kt But you might want to submit that issue to ktor anyway and tag it here |
Here's the KTOR issue https://youtrack.jetbrains.com/issue/KTOR-6709 |
@eskatos I re-published with support for I got rid of assuming a |
Sorry it took me so long to get back to you. |
@eskatos it should be in the 1.0 beta. The only reason it's beta is because it uses ktor |
Doing
asyncPainterResource("file://path/to/image.png")
currently fails with the following exception:I would have expected this to load the local image from the filesystem.
I do this from a
commonMain
source set where I can't usejava.io.File
.For the time being I worked around it with an
expect
/actual
function to callasyncPainterResource(File)
forfile:
URLs on the JVM platform. This is a totally viable workaround but supportingfile:
URLs out of the box would make Kamel easier to use.The text was updated successfully, but these errors were encountered: