Skip to content

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

@Grizouforever

Description

@Grizouforever

Description

File paths from PR changes are interpolated directly into GraphQL query strings without escaping double-quote characters. A file path containing " (valid on most filesystems) breaks the GraphQL query syntax, causing the file content fetch to fail silently and the PR to receive a score of 0.

Affected code

  • gittensor/utils/github_api_tools.py line 1264: expression = f'{head_sha}:{path}' interpolated into a quoted GraphQL field
  • gittensor/utils/github_api_tools.py lines 1374, 1381: Same pattern in _fetch_file_contents_with_base_batch

Expected behavior

File paths with special characters should be properly escaped before interpolation into GraphQL queries.

Actual behavior

The GraphQL query becomes malformed, causing a silent failure that results in missing file contents and a 0 score for affected files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions