dioxus
dioxus copied to clipboard
`use_asset_handler` no longer works on 0.6.0
Problem
I upgraded to 0.6.0 for better mobile support, but my use_asset_handler no longer works, it is not producing any stdout output either. Downgrading to 0.5.6 brings back the functionality as normal.
use_asset_handler code below, if that affects anything
use_asset_handler("trackimage", move |request, responder| {
println!("{:?}", request.uri());
let id = request.uri().path().replace("/trackimage/", "");
let path = &TRACKS.read()[CURRENT()].file;
println!("{path}");
let tag = Tag::read_from_path(path).unwrap();
let mut file = Cursor::new(tag.pictures().next().unwrap().data.clone());
tokio::task::spawn(async move {
match get_stream_response(&mut file, &request).await {
Ok(response) => responder.respond(response),
Err(err) => eprintln!("Error: {}", err),
}
});
});
Steps To Reproduce
Steps to reproduce the behavior:
- Be on v0.6.0
- have use_asset_handler somewhere in your code to redirect asset requests
- have some element that requests the given redirect
Expected behavior
For the image to show as the image shows below (when on v0.5.6)
On v0.6.0 there is no image, and a 404 shows up in the console.
Environment:
- Dioxus version: v0.6.0
- Rust version: 1.81.0 nightly
- OS info: Windows
- App platform: Desktop
Questionnaire
I'm interested in fixing this myself but don't know where to start