Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github Search throws exception if the search query is longer than 128 characters #314

Open
avimanyum opened this issue Feb 21, 2022 · 1 comment

Comments

@avimanyum
Copy link
Contributor

Describe the bug
While searching for an image in git repos, github search API throws an exception if the query length is greater than 128 characters.

To Reproduce
Steps to reproduce the behavior:

  1. Generate an image from a repo which has a long name (preferably > 128 characters)
  2. Run DFIU on the docker image that gets generated from the above repo
  3. Notice that the search API throws an exception while looking for Dockerfiles where this image is being used.

Expected behavior
Provide a workaround to handle scenarios where the query length is greater than 128 characters.

Screenshots
Caused by: org.kohsuke.github.HttpException: {"message":"Validation Failed","errors":[{"message":"The search is longer than 128 characters.","resource":"Search","field":"q","code":"invalid"}],"documentation_url":"https://docs.github.com/enterprise/3.1/v3/search/"}

Computing Environment (please complete the following information):

  • Docker or Java? Docker
  • Java Runtime (if Java)
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@pchugh17
Copy link
Contributor

Github documentation says:

There are some limits to the length of the queries when searching across GitHub:

Queries longer than 256 characters are not supported
You can't construct a query using more than five AND, OR, or NOT operators
Specific search types, such as code search, might have additional limitations. Check the documentation for these search types for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants