File tree Expand file tree Collapse file tree 3 files changed +17
-19
lines changed Expand file tree Collapse file tree 3 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -261,16 +261,11 @@ impl RestApiClient for GithubApiClient {
261261 let sha = self . sha . clone ( ) . unwrap ( ) + "/" ;
262262 let comments_url = self
263263 . api_url
264- . join ( "repos/" )
265- . unwrap ( )
266- . join ( format ! ( "{}/" , repo) . as_str ( ) )
267- . unwrap ( )
268- . join ( if is_pr { "issues/" } else { "commits/" } )
269- . unwrap ( )
270- . join ( if is_pr { pr. as_str ( ) } else { sha. as_str ( ) } )
271- . unwrap ( )
272- . join ( "comments/" )
273- . unwrap ( ) ;
264+ . join ( "repos/" ) ?
265+ . join ( format ! ( "{}/" , repo) . as_str ( ) ) ?
266+ . join ( if is_pr { "issues/" } else { "commits/" } ) ?
267+ . join ( if is_pr { pr. as_str ( ) } else { sha. as_str ( ) } ) ?
268+ . join ( "comments" ) ?;
274269
275270 self . update_comment (
276271 comments_url,
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ impl GithubApiClient {
205205 } ) ?,
206206 ) ;
207207 let repo = format ! (
208- "repos/{}/comments/ " ,
208+ "repos/{}/comments" ,
209209 // if we got here, then we know it is on a CI runner as self.repo should be known
210210 self . repo. as_ref( ) . expect( "Repo name unknown." )
211211 ) ;
@@ -243,11 +243,14 @@ impl GithubApiClient {
243243 comment. user. login,
244244 comment. user. id,
245245 ) ;
246- let this_comment_url = base_comment_url
247- . join ( & comment. id . to_string ( ) )
248- . with_context ( || {
249- format ! ( "Failed to parse URL for JSON comment.id: {}" , comment. id)
250- } ) ?;
246+ let this_comment_url =
247+ Url :: parse ( format ! ( "{base_comment_url}/{}" , & comment. id) . as_str ( ) )
248+ . with_context ( || {
249+ format ! (
250+ "Failed to parse URL for JSON comment.id: {}" ,
251+ comment. id
252+ )
253+ } ) ?;
251254 if delete || comment_url. is_some ( ) {
252255 // if not updating: remove all outdated comments
253256 // if updating: remove all outdated comments except the last one
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ async fn setup(lib_root: &Path, test_params: &TestParams) {
106106 server
107107 . mock (
108108 "GET" ,
109- format ! ( "/repos/{REPO}/commits/{SHA}/comments/ " ) . as_str ( ) ,
109+ format ! ( "/repos/{REPO}/commits/{SHA}/comments" ) . as_str ( ) ,
110110 )
111111 . match_header ( "Accept" , "application/vnd.github.raw+json" )
112112 . match_header ( "Authorization" , TOKEN )
@@ -123,7 +123,7 @@ async fn setup(lib_root: &Path, test_params: &TestParams) {
123123 . create ( ) ,
124124 ) ;
125125 } else {
126- let pr_endpoint = format ! ( "/repos/{REPO}/issues/{PR}/comments/ " ) ;
126+ let pr_endpoint = format ! ( "/repos/{REPO}/issues/{PR}/comments" ) ;
127127 for pg in [ "1" , "2" ] {
128128 let link = if pg == "1" {
129129 format ! ( "<{}{pr_endpoint}?page=2>; rel=\" next\" " , server. url( ) )
@@ -190,7 +190,7 @@ async fn setup(lib_root: &Path, test_params: &TestParams) {
190190 . mock (
191191 "POST" ,
192192 format ! (
193- "/repos/{REPO}/{}/comments/ " ,
193+ "/repos/{REPO}/{}/comments" ,
194194 if test_params. event_t == EventType :: PullRequest {
195195 format!( "issues/{PR}" )
196196 } else {
You can’t perform that action at this time.
0 commit comments