Skip to content

Commit

Permalink
Add project key to cache key (jenkinsci#837)
Browse files Browse the repository at this point in the history
If a requests is sent with a project key, and the key is not part of the cache key, following requests for other projects will result in the cached repositories for the first project, leading to wrong results
  • Loading branch information
thomas-boehm-tractive authored Oct 29, 2024
1 parent b26cce5 commit 15dc416
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -787,11 +787,17 @@ public List<BitbucketCloudRepository> getRepositories(@CheckForNull UserRoleInRe
.set("pagelen", MAX_PAGE_LENGTH);
if (StringUtils.isNotBlank(projectKey)) {
template.set("q", "project.key=" + "\"" + projectKey + "\""); // q=project.key="<projectKey>"
cacheKey.append("::").append(projectKey);
} else {
cacheKey.append("::<undefined>");
}
if (role != null && authenticator != null) {
template.set("role", role.getId());
cacheKey.append("::").append(role.getId());
} else {
cacheKey.append("::<undefined>");
}

Callable<List<BitbucketCloudRepository>> request = () -> {
List<BitbucketCloudRepository> repositories = new ArrayList<>();
Integer pageNumber = 1;
Expand Down

0 comments on commit 15dc416

Please sign in to comment.