@@ -514,58 +514,57 @@ impl SysBackend for WebBackend {
514514 cache_url ( & url, tree_res) ;
515515 unmark_working ( & original_url) ;
516516 return ;
517- } else {
518- let tree = tree_res. unwrap ( ) ;
519- let tree: serde_json:: Value = serde_json:: from_str ( & tree) . unwrap ( ) ;
520- let tree = tree. get ( "tree" ) . unwrap ( ) . as_array ( ) . unwrap ( ) ;
521- let paths = tree
522- . iter ( )
523- . filter_map ( |entry| {
524- let path = entry. get ( "path" ) ?. as_str ( ) ?;
525- if Path :: new ( path)
526- . extension ( )
527- . is_some_and ( |ext| ext. eq_ignore_ascii_case ( "ua" ) )
528- {
529- Some ( path. to_string ( ) )
530- } else {
531- None
532- }
533- } )
534- . collect :: < HashSet < _ > > ( ) ;
535-
536- if !paths. contains ( "lib.ua" ) {
537- cache_url ( & url, Err ( "lib.ua not found" . into ( ) ) ) ;
538- unmark_working ( & original_url) ;
539- return ;
540- }
541-
542- let results = join_all ( paths. iter ( ) . map ( |path| {
543- let repo_owner = repo_owner. clone ( ) ;
544- let repo_name = repo_name. clone ( ) ;
545- async move {
546- let fetch_url = format ! (
547- "https://raw.githubusercontent.com\
548- /{repo_owner}/{repo_name}/main/{path}",
549- ) ;
550- let internal_path = Path :: new ( "uiua-modules" )
551- . join ( repo_owner)
552- . join ( repo_name)
553- . join ( path. clone ( ) ) ;
554-
555- ( path, internal_path, fetch ( fetch_url. as_str ( ) ) . await )
517+ }
518+ let tree = tree_res. unwrap ( ) ;
519+ let tree: serde_json:: Value = serde_json:: from_str ( & tree) . unwrap ( ) ;
520+ let tree = tree. get ( "tree" ) . unwrap ( ) . as_array ( ) . unwrap ( ) ;
521+ let paths = tree
522+ . iter ( )
523+ . filter_map ( |entry| {
524+ let path = entry. get ( "path" ) ?. as_str ( ) ?;
525+ if Path :: new ( path)
526+ . extension ( )
527+ . is_some_and ( |ext| ext. eq_ignore_ascii_case ( "ua" ) )
528+ {
529+ Some ( path. to_string ( ) )
530+ } else {
531+ None
556532 }
557- } ) )
558- . await ;
533+ } )
534+ . collect :: < HashSet < _ > > ( ) ;
559535
560- for ( original_path, internal_path, res) in results {
561- if original_path. eq ( "lib.ua" ) {
562- cache_url ( & url, res. clone ( ) ) ;
563- }
536+ if !paths. contains ( "lib.ua" ) {
537+ cache_url ( & url, Err ( "lib.ua not found" . into ( ) ) ) ;
538+ unmark_working ( & original_url) ;
539+ return ;
540+ }
564541
565- if let Ok ( text) = res {
566- let contents = text. as_bytes ( ) . to_vec ( ) ;
567- drop_file ( internal_path. clone ( ) , contents) ;
568- }
542+ let results = join_all ( paths. iter ( ) . map ( |path| {
543+ let repo_owner = repo_owner. clone ( ) ;
544+ let repo_name = repo_name. clone ( ) ;
545+ async move {
546+ let fetch_url = format ! (
547+ "https://raw.githubusercontent.com\
548+ /{repo_owner}/{repo_name}/main/{path}",
549+ ) ;
550+ let internal_path = Path :: new ( "uiua-modules" )
551+ . join ( repo_owner)
552+ . join ( repo_name)
553+ . join ( path. clone ( ) ) ;
554+
555+ ( path, internal_path, fetch ( fetch_url. as_str ( ) ) . await )
556+ }
557+ } ) )
558+ . await ;
559+
560+ for ( original_path, internal_path, res) in results {
561+ if original_path. eq ( "lib.ua" ) {
562+ cache_url ( & url, res. clone ( ) ) ;
563+ }
564+
565+ if let Ok ( text) = res {
566+ let contents = text. as_bytes ( ) . to_vec ( ) ;
567+ drop_file ( internal_path. clone ( ) , contents) ;
569568 }
570569 }
571570
0 commit comments