Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-23105

Bitbucket API pagination issue in code search endpoint

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • Product - Search
    • None

    Description

      Issue Summary

      Executing a GET request (2.0/teams/workspaceID/search/code?search=) or (2.0/workspace/workspaceID/search/code?search=) to fetch code search results, the pagination link for the next page swaps a '?' with an '&'. This behavior is also applicable when doing this search within the UI

      Steps to Reproduce

      Execute a GET request to

      https://api.bitbucket.org/2.0/workspaces/workspaceID/search/code?search_query=search_query
      

      Expected Results

      The pagination link in the API response correctly format query parameters, maintaining the '?' before the first parameter and using '&' only to separate additional parameters, for example

      "https://api.bitbucket.org/2.0/workspaces/workspace/search/code?search_query=test&page=2"
      

      Actual Results

      The API's response incorrectly formats the next page link by substituting '?' with '&', resulting in a malformed URL that leads to navigation errors:

      "https://api.bitbucket.org/2.0/workspaces/workspace/search/code&search_query=test&page=2"
      

      Workaround

      Copying the provided link from the response and replacing the '&' back with a '?'

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ncsupka Norbert C
              Votes:
              5 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: