Skip to content
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

use_asset_handler no longer works on 0.6.0 #3306

Open
rhaskia opened this issue Dec 8, 2024 · 0 comments
Open

use_asset_handler no longer works on 0.6.0 #3306

rhaskia opened this issue Dec 8, 2024 · 0 comments

Comments

@rhaskia
Copy link

rhaskia commented Dec 8, 2024

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)
image
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant