@@ -2470,12 +2470,32 @@ impl<RT: Runtime> Application<RT> {
24702470 storage_id : FileStorageId ,
24712471 ) -> anyhow:: Result < FileStream > {
24722472 self . bail_if_not_running ( ) . await ?;
2473- let file_entry = self . get_file_entry ( component, storage_id) . await ?;
2473+ let mut file_storage_tx = self . begin ( Identity :: system ( ) ) . await ?;
2474+ let Some ( file_entry) = self
2475+ . file_storage
2476+ . transactional_file_storage
2477+ // The transaction is not part of UDF so use the global usage counters.
2478+ . get_file_entry ( & mut file_storage_tx, component. into ( ) , storage_id. clone ( ) )
2479+ . await ?
2480+ else {
2481+ return Err ( ErrorMetadata :: transient_not_found (
2482+ "FileNotFound" ,
2483+ format ! ( "File {storage_id} not found" ) ,
2484+ )
2485+ . into ( ) ) ;
2486+ } ;
2487+ let Some ( component_path) = file_storage_tx. get_component_path ( component) else {
2488+ return Err ( ErrorMetadata :: transient_not_found (
2489+ "FileNotFound" ,
2490+ format ! ( "Component {component:?} not found" ) ,
2491+ )
2492+ . into ( ) ) ;
2493+ } ;
24742494 self
24752495 . file_storage
24762496 . transactional_file_storage
24772497 // The transaction is not part of UDF so use the global usage counters.
2478- . get_file_stream ( file_entry, self . usage_tracking . clone ( ) )
2498+ . get_file_stream ( component_path , file_entry, self . usage_tracking . clone ( ) )
24792499 . await
24802500 }
24812501
@@ -2501,12 +2521,24 @@ impl<RT: Runtime> Application<RT> {
25012521 )
25022522 . into ( ) ) ;
25032523 } ;
2524+ let Some ( component_path) = file_storage_tx. get_component_path ( component) else {
2525+ return Err ( ErrorMetadata :: transient_not_found (
2526+ "FileNotFound" ,
2527+ format ! ( "Component {component:?} not found" ) ,
2528+ )
2529+ . into ( ) ) ;
2530+ } ;
25042531
25052532 self
25062533 . file_storage
25072534 . transactional_file_storage
25082535 // The transaction is not part of UDF so use the global usage counters.
2509- . get_file_range_stream ( file_entry, bytes_range, self . usage_tracking . clone ( ) )
2536+ . get_file_range_stream (
2537+ component_path,
2538+ file_entry,
2539+ bytes_range,
2540+ self . usage_tracking . clone ( ) ,
2541+ )
25102542 . await
25112543 }
25122544
0 commit comments