Skip to content

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

Open
@fabianboesiger

Description

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(())
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions