File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ ---
4+
5+ Fixes ` asset ` protocol crashing application.
Original file line number Diff line number Diff line change @@ -343,15 +343,6 @@ impl<P: Params> WindowManager<P> {
343343 current_window_label = label. to_js_string( ) ?,
344344 ) ) ;
345345
346- webview_attributes. uri_scheme_protocols . insert (
347- "asset" . into ( ) ,
348- Box :: new ( move |url| {
349- let path = url. replace ( "asset://" , "" ) ;
350- let data = crate :: async_runtime:: block_on ( async move { tokio:: fs:: read ( path) . await } ) ?;
351- Ok ( data)
352- } ) ,
353- ) ;
354-
355346 #[ cfg( dev) ]
356347 {
357348 webview_attributes = webview_attributes. initialization_script ( & format ! (
@@ -386,6 +377,13 @@ impl<P: Params> WindowManager<P> {
386377 webview_attributes = webview_attributes
387378 . register_uri_scheme_protocol ( "tauri" , self . prepare_uri_scheme_protocol ( ) . protocol ) ;
388379 }
380+ if !webview_attributes. has_uri_scheme_protocol ( "asset" ) {
381+ webview_attributes = webview_attributes. register_uri_scheme_protocol ( "asset" , move |url| {
382+ let path = url. replace ( "asset://" , "" ) ;
383+ let data = crate :: async_runtime:: block_on ( async move { tokio:: fs:: read ( path) . await } ) ?;
384+ Ok ( data)
385+ } ) ;
386+ }
389387
390388 let local_app_data = resolve_path (
391389 & self . inner . config ,
You can’t perform that action at this time.
0 commit comments