vscode-pull-request-github icon indicating copy to clipboard operation
vscode-pull-request-github copied to clipboard

Trim whitespace from issue query strings

Open Copilot opened this issue 2 months ago • 0 comments

Trailing whitespace in githubIssues.queries configuration causes GitHub's search API to return different results, as shown in the screenshots where the same query with/without a trailing space displays different issues.

Changes

  • src/issues/stateManager.ts: Added .trim() to query string after variable substitution before passing to GitHub API
  • src/test/issues/stateManager.test.ts: Added test verifying queries with trailing whitespace are properly trimmed

The fix handles the case where users accidentally include whitespace when editing their query configuration:

// Before: whitespace passed directly to API
variableSubstitution(query.query, undefined, undefined, user)

// After: whitespace trimmed
variableSubstitution(query.query, undefined, undefined, user).trim()

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/20.19.6/x64/bin/node /opt/hostedtoolcache/node/20.19.6/x64/bin/node ./out/src/test/runTests.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Blank space at end of query string produces different results</issue_title> <issue_description>

Version: 1.100.0-insider (user setup)
Commit: ecbbe26188235072fbde7b6f4fd2a0bd6a7c9909
Date: 2025-04-29T05:04:19.843Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.22635
  • Extension version: 0.109.2025042904 (pre-release)

  • Repository Clone Configuration (single repository/fork of an upstream repository): https://github.com/chrisdias/todo-app

  • Github Product (Github.com/Github Enterprise version x.x.x): Enterprise (not sure what... Microsoft)

A blank space at the end of a query string returns different results.

Blank space at end

Image

Remove the blank space, now I get an issue from another repository (the "Product Feedbac...") issue.

Image</issue_description>

<agent_instructions>Trim the query string before running it</agent_instructions>

Comments on the Issue (you are @copilot in this section)

  • Fixes microsoft/vscode-pull-request-github#6883

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot avatar Dec 10 '25 16:12 Copilot