@@ -169,6 +169,11 @@ private void runWithGit(final Git git) {
169169 }
170170 }
171171
172+ private static String apiUrl (final FillExtension extension ) {
173+ final String url = extension .getApiUrl ().get ();
174+ return url .endsWith ("/" ) ? url .substring (0 , url .length () - 1 ) : url ;
175+ }
176+
172177 private URI requestUploadUrl (
173178 final FillExtension extension ,
174179 final String apiToken ,
@@ -177,7 +182,7 @@ private URI requestUploadUrl(
177182 ) throws IOException , InterruptedException {
178183 final StageRequest request = new StageRequest (id , upload .download (), upload .contentType (), upload .contentMd5 ());
179184 final HttpRequest httpRequest = HttpRequest .newBuilder ()
180- .uri (URI .create (extension . getApiUrl (). get ( ) + "/v3/publishing/stage" ))
185+ .uri (URI .create (apiUrl ( extension ) + "/v3/publishing/stage" ))
181186 .header ("Authorization" , apiToken )
182187 .header ("Content-Type" , "application/json" )
183188 .header ("User-Agent" , USER_AGENT )
@@ -210,7 +215,7 @@ private void publish(
210215 final PublishRequest request
211216 ) throws IOException , InterruptedException {
212217 final HttpRequest httpRequest = HttpRequest .newBuilder ()
213- .uri (URI .create (extension . getApiUrl (). get ( ) + "/v3/publishing/publish" ))
218+ .uri (URI .create (apiUrl ( extension ) + "/v3/publishing/publish" ))
214219 .header ("Authorization" , apiToken )
215220 .header ("Content-Type" , "application/json" )
216221 .header ("User-Agent" , USER_AGENT )
@@ -352,7 +357,7 @@ private List<BuildResponse> fetchLastVersionBuilds(final FillExtension extension
352357 private VersionsResponse getVersions (final FillExtension extension ) {
353358 final String url = String .format (
354359 "%s/v3/projects/%s/versions" ,
355- extension . getApiUrl (). get ( ),
360+ apiUrl ( extension ),
356361 extension .getProject ().get ()
357362 );
358363 try {
@@ -376,7 +381,7 @@ private VersionsResponse getVersions(final FillExtension extension) {
376381 private List <BuildResponse > getBuilds (final FillExtension extension , final String version ) {
377382 final String url = String .format (
378383 "%s/v3/projects/%s/versions/%s/builds" ,
379- extension . getApiUrl (). get ( ),
384+ apiUrl ( extension ),
380385 extension .getProject ().get (),
381386 version
382387 );
0 commit comments