Skip to content

Commit

Permalink
Add project key to cache key
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 committed Mar 28, 2024
1 parent 4733e8c commit 2f7a1a4
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -768,10 +768,15 @@ 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<>();
Expand Down

0 comments on commit 2f7a1a4

Please sign in to comment.