Open
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