File tree 3 files changed +17
-19
lines changed
3 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -265,16 +265,11 @@ impl RestApiClient for GithubApiClient {
265
265
let sha = self . sha . clone ( ) . unwrap ( ) + "/" ;
266
266
let comments_url = self
267
267
. api_url
268
- . join ( "repos/" )
269
- . unwrap ( )
270
- . join ( format ! ( "{}/" , repo) . as_str ( ) )
271
- . unwrap ( )
272
- . join ( if is_pr { "issues/" } else { "commits/" } )
273
- . unwrap ( )
274
- . join ( if is_pr { pr. as_str ( ) } else { sha. as_str ( ) } )
275
- . unwrap ( )
276
- . join ( "comments/" )
277
- . unwrap ( ) ;
268
+ . join ( "repos/" ) ?
269
+ . join ( format ! ( "{}/" , repo) . as_str ( ) ) ?
270
+ . join ( if is_pr { "issues/" } else { "commits/" } ) ?
271
+ . join ( if is_pr { pr. as_str ( ) } else { sha. as_str ( ) } ) ?
272
+ . join ( "comments" ) ?;
278
273
279
274
self . update_comment (
280
275
comments_url,
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ impl GithubApiClient {
205
205
} ) ?,
206
206
) ;
207
207
let repo = format ! (
208
- "repos/{}/comments/ " ,
208
+ "repos/{}/comments" ,
209
209
// if we got here, then we know it is on a CI runner as self.repo should be known
210
210
self . repo. as_ref( ) . expect( "Repo name unknown." )
211
211
) ;
@@ -243,11 +243,14 @@ impl GithubApiClient {
243
243
comment. user. login,
244
244
comment. user. id,
245
245
) ;
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
+ } ) ?;
251
254
if delete || comment_url. is_some ( ) {
252
255
// if not updating: remove all outdated comments
253
256
// 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) {
106
106
server
107
107
. mock (
108
108
"GET" ,
109
- format ! ( "/repos/{REPO}/commits/{SHA}/comments/ " ) . as_str ( ) ,
109
+ format ! ( "/repos/{REPO}/commits/{SHA}/comments" ) . as_str ( ) ,
110
110
)
111
111
. match_header ( "Accept" , "application/vnd.github.raw+json" )
112
112
. match_header ( "Authorization" , TOKEN )
@@ -123,7 +123,7 @@ async fn setup(lib_root: &Path, test_params: &TestParams) {
123
123
. create ( ) ,
124
124
) ;
125
125
} else {
126
- let pr_endpoint = format ! ( "/repos/{REPO}/issues/{PR}/comments/ " ) ;
126
+ let pr_endpoint = format ! ( "/repos/{REPO}/issues/{PR}/comments" ) ;
127
127
for pg in [ "1" , "2" ] {
128
128
let link = if pg == "1" {
129
129
format ! ( "<{}{pr_endpoint}?page=2>; rel=\" next\" " , server. url( ) )
@@ -190,7 +190,7 @@ async fn setup(lib_root: &Path, test_params: &TestParams) {
190
190
. mock (
191
191
"POST" ,
192
192
format ! (
193
- "/repos/{REPO}/{}/comments/ " ,
193
+ "/repos/{REPO}/{}/comments" ,
194
194
if test_params. event_t == EventType :: PullRequest {
195
195
format!( "issues/{PR}" )
196
196
} else {
You can’t perform that action at this time.
0 commit comments