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

Error closure invoked recursively or after being dropped when opening ObjectUrl via window().open_with_url() #465

Open
fabianboesiger opened this issue Apr 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@fabianboesiger
Copy link

fabianboesiger commented Apr 23, 2024

Describe the Bug

When opening a file via ObjectUrl and window().open_with_url(), the file is opened but the following error is thrown in the console:

Uncaught Error: closure invoked recursively or after being dropped

Steps to Reproduce

Use the following code snippet to open a file.

pub fn download_file(name: &str, contents: &[u8], mime_type: Option<&str>) -> Result<(), Error> {
    let file = gloo::file::File::new_with_options::<&[u8]>(name, contents, mime_type, None);
    let object_url = gloo::file::ObjectUrl::from(file);
    let download_url = Box::leak(object_url.to_string().into_boxed_str());

    
    gloo::utils::window()
        .open_with_url_and_target(download_url, "_blank")
        .unwrap();

    Ok(())
}
@fabianboesiger fabianboesiger added the bug Something isn't working label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant