@@ -84,10 +84,14 @@ pub trait ApiHandler: Send + Sync {
8484
8585 async fn get_commits_by_hashes ( & self , c_hashes : Vec < String > ) -> Result < Vec < Commit > , GitError > ;
8686
87- async fn get_blob_as_string ( & self , file_path : PathBuf ) -> Result < Option < String > , GitError > {
87+ async fn get_blob_as_string (
88+ & self ,
89+ file_path : PathBuf ,
90+ refs : Option < & str > ,
91+ ) -> Result < Option < String > , GitError > {
8892 let filename = file_path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
8993 let parent = file_path. parent ( ) . unwrap ( ) ;
90- if let Some ( tree) = self . search_tree_by_path ( parent) . await ?
94+ if let Some ( tree) = self . search_tree_by_path_with_refs ( parent, refs ) . await ?
9195 && let Some ( item) = tree. tree_items . into_iter ( ) . find ( |x| x. name == filename)
9296 {
9397 match self . get_raw_blob_by_hash ( & item. id . to_string ( ) ) . await {
@@ -111,8 +115,14 @@ pub trait ApiHandler: Send + Sync {
111115 let commit = self . get_tree_relate_commit ( tree. id , path) . await ?;
112116 let mut commit_info: LatestCommitInfo = commit. into ( ) ;
113117
114- // Build commit binding information
115- commit_info. binding_info = self . build_commit_binding_info ( & commit_info. oid ) . await ?;
118+ if let Some ( binding) = self . build_commit_binding_info ( & commit_info. oid ) . await ? {
119+ let display = binding. display_name . clone ( ) ;
120+ let avatar = binding. avatar_url . clone ( ) . unwrap_or_default ( ) ;
121+
122+ // Fill both author for UI consumption
123+ commit_info. author . display_name = display. clone ( ) ;
124+ commit_info. author . avatar_url = avatar. clone ( ) ;
125+ }
116126
117127 Ok ( commit_info)
118128 }
0 commit comments