From 30be8c1e36f3a3055d0f0e85ad5050e7fe86f6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20M=C3=BCller?= <9016208+Seros@users.noreply.github.com> Date: Tue, 11 Jul 2023 17:08:49 +0200 Subject: [PATCH] Fix endless loop when fetching branch by filterText from Bitbucket Server API (#737) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix endless loop when fetching branch by filterText from Bitbucket Server API * fix endless loop when fetching tag by filterText from Bitbucket Server API --------- Co-authored-by: Günter Grodotzki --- .../bitbucket/server/client/BitbucketServerAPIClient.java | 4 ++-- ...ranches_filterText_feature_2FBB-1_start_0_limit_200.json} | 0 ...ranches_filterText_feature_2FBB-2_start_0_limit_200.json} | 0 ...st-repos-branches_filterText_main_start_0_limit_200.json} | 0 ...es_filterText_release_2Frelease-1_start_0_limit_200.json} | 0 ..._3C_26_23__3D_40_21_7C._2C_2Ftest_start_0_limit_200.json} | 5 +++-- ...test-repos-tags_filterText_v0.0.0_start_0_limit_200.json} | 2 +- 7 files changed, 6 insertions(+), 5 deletions(-) rename src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/{1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-1.json => 1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-1_start_0_limit_200.json} (100%) rename src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/{1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-2.json => 1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-2_start_0_limit_200.json} (100%) rename src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/{1.0-projects-amuniz-repos-test-repos-branches_filterText_main.json => 1.0-projects-amuniz-repos-test-repos-branches_filterText_main_start_0_limit_200.json} (100%) rename src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/{1.0-projects-amuniz-repos-test-repos-branches_filterText_release_2Frelease-1.json => 1.0-projects-amuniz-repos-test-repos-branches_filterText_release_2Frelease-1_start_0_limit_200.json} (100%) rename src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/{1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest.json => 1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest_start_0_limit_200.json} (91%) rename src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/{1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0.json => 1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0_start_0_limit_200.json} (95%) diff --git a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/server/client/BitbucketServerAPIClient.java b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/server/client/BitbucketServerAPIClient.java index dc3a8bd8d..eac2e0572 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/server/client/BitbucketServerAPIClient.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/server/client/BitbucketServerAPIClient.java @@ -139,9 +139,9 @@ public class BitbucketServerAPIClient implements BitbucketApi { private static final String API_REPOSITORY_PATH = API_BASE_PATH + "/projects/{owner}/repos/{repo}"; private static final String API_DEFAULT_BRANCH_PATH = API_REPOSITORY_PATH + "/branches/default"; private static final String API_BRANCHES_PATH = API_REPOSITORY_PATH + "/branches{?start,limit}"; - private static final String API_BRANCHES_FILTERED_PATH = API_REPOSITORY_PATH + "/branches{?filterText}"; + private static final String API_BRANCHES_FILTERED_PATH = API_REPOSITORY_PATH + "/branches{?filterText,start,limit}"; private static final String API_TAGS_PATH = API_REPOSITORY_PATH + "/tags{?start,limit}"; - private static final String API_TAGS_FILTERED_PATH = API_REPOSITORY_PATH + "/tags{?filterText}"; + private static final String API_TAGS_FILTERED_PATH = API_REPOSITORY_PATH + "/tags{?filterText,start,limit}"; private static final String API_PULL_REQUESTS_PATH = API_REPOSITORY_PATH + "/pull-requests{?start,limit,at,direction,state}"; private static final String API_PULL_REQUEST_PATH = API_REPOSITORY_PATH + "/pull-requests/{id}"; private static final String API_PULL_REQUEST_MERGE_PATH = API_REPOSITORY_PATH + "/pull-requests/{id}/merge"; diff --git a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-1.json b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-1_start_0_limit_200.json similarity index 100% rename from src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-1.json rename to src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-1_start_0_limit_200.json diff --git a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-2.json b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-2_start_0_limit_200.json similarity index 100% rename from src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-2.json rename to src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_feature_2FBB-2_start_0_limit_200.json diff --git a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_main.json b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_main_start_0_limit_200.json similarity index 100% rename from src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_main.json rename to src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_main_start_0_limit_200.json diff --git a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_release_2Frelease-1.json b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_release_2Frelease-1_start_0_limit_200.json similarity index 100% rename from src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_release_2Frelease-1.json rename to src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-branches_filterText_release_2Frelease-1_start_0_limit_200.json diff --git a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest.json b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest_start_0_limit_200.json similarity index 91% rename from src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest.json rename to src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest_start_0_limit_200.json index b25d2c9bb..aabc69350 100644 --- a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest.json +++ b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_special-_22_24_3B_3E_3C_26_23__3D_40_21_7C._2C_2Ftest_start_0_limit_200.json @@ -1,6 +1,6 @@ { "size": 1, - "limit": 25, + "limit": 200, "isLastPage": true, "values": [ { @@ -11,5 +11,6 @@ "latestChangeset": "046d9a3c1532acf4cf08fe93235c00e4d673c1d2", "hash": "c7208aca6fa205f115585be56a817f0cf2a43e62" } - ] + ], + "start": 0 } diff --git a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0.json b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0_start_0_limit_200.json similarity index 95% rename from src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0.json rename to src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0_start_0_limit_200.json index cee584975..f3387e489 100644 --- a/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0.json +++ b/src/test/resources/com/cloudbees/jenkins/plugins/bitbucket/server/payload/1.0-projects-amuniz-repos-test-repos-tags_filterText_v0.0.0_start_0_limit_200.json @@ -1,6 +1,6 @@ { "size": 1, - "limit": 25, + "limit": 200, "isLastPage": true, "values": [ {