Skip to content

fix: escape special characters in GraphQL file path expressions#393

Open
t7929375-eng wants to merge 1 commit intoentrius:testfrom
t7929375-eng:fix/graphql-path-escaping
Open

fix: escape special characters in GraphQL file path expressions#393
t7929375-eng wants to merge 1 commit intoentrius:testfrom
t7929375-eng:fix/graphql-path-escaping

Conversation

@t7929375-eng
Copy link
Copy Markdown

Summary

File paths containing double quotes or backslashes are interpolated directly into GraphQL expression fields (e.g. {sha}:{path}), producing syntactically invalid queries. This causes _fetch_file_contents_batch and _fetch_file_contents_with_base_batch to silently return empty results for affected files, giving those PRs a score of 0.

Adds a _escape_graphql_string helper and applies it to all three path interpolation sites:

  • _fetch_file_contents_batch (head expression)
  • _fetch_file_contents_with_base_batch (base expression)
  • _fetch_file_contents_with_base_batch (head expression)

Related Issues

Fixes #368

Type of Change

  • Bug fix

Testing

  • ruff check passes
  • ruff format passes
  • pyright passes (0 errors)
  • Self-reviewed

Checklist

  • Code follows project style guidelines
  • Self-review completed

cc @anderdc @LandynDev

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

Successfully merging this pull request may close these issues.

Bug: GraphQL query breaks when file paths contain double-quote characters

1 participant