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

Issues with Search REST API: Special Characters Handling #2673

Open
1 task done
Le-Caignec opened this issue May 7, 2024 · 1 comment
Open
1 task done

Issues with Search REST API: Special Characters Handling #2673

Le-Caignec opened this issue May 7, 2024 · 1 comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@Le-Caignec
Copy link

Le-Caignec commented May 7, 2024

What happened?

Hello,

I am currently using the Octokit library to interact with the GitHub Search REST API, and I am facing to an issue that is impacting my ability to use it effectively:

.Handling of Special Characters: Queries that include certain special characters do not execute as expected. For example, the query containing return ( fails, whereas return( (without a space before the parenthesis) succeeds. I attempted to resolve this issue using encodeURI, as recommended in some discussions on GitHub, but it seems this workaround does not apply effectively when using Octokit to interact with the search API.

Here is an example of a failing query:

const query = 'return (';
const results = await octokit.rest.search.code({
  q: query
});

And a succeeding one:

const query = 'return( ';
const results = await octokit.rest.search.code({
  q: query
});

Could you please provide guidance on how to handle these issues? Are there any recommended practices for managing long queries and special characters specifically through Octokit? Any help would be greatly appreciated as these limitations are hindering my usage of the API for larger, more complex code searches.

Thank you for your assistance.

Versions

Node: v20
Octokit: 3.1.2

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Le-Caignec Le-Caignec added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels May 7, 2024
Copy link

github-actions bot commented May 7, 2024

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
Status: 🔥 Backlog
Development

No branches or pull requests

1 participant