Skip to content

terminal: preserve special characters in file names dropped into terminal#28

Closed
yogeshwaran-c wants to merge 5179 commits intomainfrom
fix/terminal-special-chars-drag-drop
Closed

terminal: preserve special characters in file names dropped into terminal#28
yogeshwaran-c wants to merge 5179 commits intomainfrom
fix/terminal-special-chars-drag-drop

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Owner

Characters such as ~, `, !, #, $, ^, &, *, |, ;, <, > were silently stripped from file paths when dragging files from the Explorer into the terminal. This produced invalid paths pointing to non-existent files.

Root cause

escapeNonWindowsPath in src/vs/platform/terminal/common/terminalEnvironment.ts applied a bannedChars regex replacement that removed those characters before quoting:

const bannedChars = /[\`\$\|\&\>\~\#\!\^\*\;\<]/g;
newPath = newPath.replace(bannedChars, '');

Why the removal is both wrong and unnecessary

The function always wraps the resulting path in shell-appropriate quotes (single quotes for bash/sh/zsh, $'...' ANSI C quoting when both quote types are present). Inside single quotes all of the listed characters are treated as literals — they cannot cause shell injection. Removing them was incorrect behavior that corrupted valid file names.

Fix

Remove the bannedChars stripping. The quoting already provides full safety. Update the related test to assert the correct preserving behavior and add coverage for the affected characters.

Test

The existing 'should remove dangerous characters' test has been renamed 'should preserve special characters that are safe inside single quotes' with corrected expectations.

Fixes microsoft#276999

connor4312 and others added 30 commits April 8, 2026 16:55
…lative-diffs

agentHost: implement cumulative diffs per session
* Chat memory leak fixes

Co-authored-by: Copilot <copilot@github.com>

* Comments

* Dispose allRefs on chat markdown part

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
* Simplify model handling in Claude

It's gotten so complicated and now that we use the built-in model picker, we can simplify this code a lot.

* refactor(claude): remove unused mock class and simplify model retrieval

* Move selecting the endpoint into the IClaudeCodeModels
Refactors repeated session-data and diff-compute test doubles into a shared
agentHost test helper module.

- Adds reusable TestSessionDatabase and TestDiffComputeService helpers for
  tests that need in-memory file-edit metadata or deterministic diff counts.
- Adds session-data-service factories for tests that need either an injected
  database reference or an intentionally unopened/null session database.
- Updates agentHost node tests to use the common helpers instead of local
  mock database, data-service, encoder, and zero-diff implementations.

(Commit message generated by Copilot)
* Use official APIs for listing subagent messages

* feedback
* Better UI syncing during browser open

* feedback
…icrosoft#308625)

* sessions: swap order of checkmark and plus buttons in section toolbar

Move the 'Mark All as Done' checkmark button to the left (order: 0)
and the 'New Session' plus button to the right (order: 1) in the
session section toolbar.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: swap order of pin and mark-as-done on session card hover

Move pin/unpin to the left (order: 1) and mark-as-done/restore to
the right (order: 2) in the per-session-item hover toolbar.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Search/externalIngestIndex.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
`ChatSessionChangedFile2` can become `ChatSessionChangedFile`
* Add context key got GitHub remote

* Sdopt the new context key

* Fix issue with detecting the repository path
microsoft#308621)

Adds worktree deletion on archive and recreation on unarchive for both
the legacy provider API and the new controller API.

- Expose onDidChangeChatSessionItemState on the return value of
  registerChatSessionItemProvider via Object.assign
- Wire up archive/unarchive handling at the V1 registration site in
  chatSessions.ts using the exposed event
- Refresh session items after worktree recreation so changes and stats
  are recomputed in the UI

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lamingo

Fire chat input state commands with correct arguments
Fix `.selected` not being updated when changing options
…nacle

Add telemetry event for search timeouts
…aver

Remove now unused `ChatSessionChangedFile` interface
…ft#308629)

* sessions: fix archive and retention of stopped temp sessions

When a copilot-cli session is stopped before the first turn commits, the
session remained in a temp/untitled state. Archiving such a session
previously fell through to cleanup logic that deleted and disposed it
instead of archiving in-place.

- Add setArchived() to CopilotCLISession and RemoteNewSession so temp
  sessions can be archived/unarchived without deletion
- Handle CancellationError in _sendFirstChat by marking the session as
  Completed so it stays visible in the session list
- Add tests for deleting and archiving uncommitted temp sessions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: assert doesNotReject instead of swallowing sendPromise errors

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update hidden Model B agent prompt for evals

* Refine hidden Model B prompt tag structure
* feat(copilot): update session option group handling

* Fix tests

* Fixes
…rosoft#308648)

* Add `oauth` section to mcp.json to allow overriding of client id

More properties (like client secret) can come later... but this is the foundation, which is a lot of plumbing...

ref microsoft#257415

* feedback
…crosoft#308657)

* Use the modelProvider instead looking for claude for Claude agent

A little cleaner.

* feedback
…ata storage and deprecate old forkSession method (microsoft#308652)

feat: implement session forking using Copilot API with metadata storage and deprecate old forkSession method
lszomoru and others added 28 commits April 10, 2026 20:29
…soft#309070)

Adds a keyboard shortcut handler in the new chat view's input editor so that
Cmd+/ (macOS) or Ctrl+/ (Windows/Linux) opens the context attachment picker,
matching the core workbench's AttachContextAction keybinding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: cleanup recovery extension publish pipeline

* fix CI
* Stop fetching GHCR pat

* MAKE IT RED
…t#309091)

* Cleanup code related to the repository state

* Remove code specific to the Agents app

* HasGitRemote should be computed at the end of each turn to account for sessions that were started before the metadata was added
Too risky, chat model lifecycle is too confusing and there are still some references to this to do things like check the URI after it's disposed
Keep the Sessions header and workspace section titles visible in narrow sidebars by truncating them with ellipsis instead of hiding or overflowing the labels.

This preserves access to the sidebar section actions when repository names are long.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Show historical debug sessions in Agent Debug Logs

* Feedback update

* add test
…08909)

* carousel improvements

* address some comments

* address more comments + fix flickering

* use monaco scrollable element

* address comments
* Filter out Claude customization directories in sessions app

The sessions (Agents) window was incorrectly showing and allowing
creation of customizations in .claude directories. Add protected
hook methods getPromptSourceFolders() and getDefaultSourceFolders()
to PromptFilesLocator, then override them in AgenticPromptFilesLocator
to filter out Claude-specific sources (ClaudePersonal, ClaudeWorkspace,
ClaudeWorkspaceLocal).

This ensures the sessions app only shows .github and .copilot
customization directories.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review: path-based Claude filtering and fix JSDoc

- Also filter user-configured .claude paths (Config* source types)
  by checking the path string, not just the PromptFileSource enum
- Fix inaccurate JSDoc comments

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: update OS display name of the agents app

* fix: remove old start menu shortcut

* temp: bump gulp-electron for validation

* temp: bump gulp-electron

* chore: update sign.ts

* fix: entitlements for embedded app helpers

* fix: launch services registration

* chore: bump gulp-electron@1.41.2
Update the GitHub Enterprise auth provider label in product.json to use the shorter GHE name.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…placeholder (microsoft#309112)

* fix: AI customization welcome page improvements

- Fix 'New...' button to insert into active session's chat input
  instead of always targeting the new-session view
- Update placeholder text to be more workflow-oriented

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: register IChatWidgetService mock in fixture

Add missing IChatWidgetService mock to the aiCustomizationManagementEditor
fixture to prevent crash after the new service dependency was added.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* chore: rename 'Generate Workflow' to 'Customize Your Agent'

Update the getting started section title, description, and aria labels
to better reflect the purpose of the customization input.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sessions: ellipsize titlebar repo metadata first

Wrap the repository/worktree metadata in its own truncating group so it collapses before the primary AI-generated session title when the command center gets narrow.

This keeps the main session title readable longer while still preserving repository context when space allows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add agent session project metadata

(Written by Copilot)

* Persist agent session project resolution

(Written by Copilot)

* sync ahp
…nstead (microsoft#309119)

Hooks can be disabled... we don't want the user to disable hooks and then key functionality goes away.

* Edit tracking
* Enter/Exit plan mode
* tool logging

all now go through the message dispatching instead of via hooks.

Additionally, there was duplicate logic in the hooks world for logging so that was all removed since we already log hooks in the dispatcher.

this allowed us to completely delete the hook registery code.
* feat: welcome onboarding walkthrough variations A/B/C/D

* improve onboarding: sign-in CTA, keyboard mapping, skeleton themes, extensions step

* fix theme colors, keyboard mapping hint, clickable session cards, extension styling in B

* feat: add Variation E - in-context UI tour with spotlight overlay

* polish: cleaner theme skeletons, keyboard mapping pills, and session cards

* fix tour alignment: ID-based targeting, centered popovers, welcome tab setup

* tour: add sign-in as final step

* removed variations

* updated layout to match sessions experience

* refined

* Feature clean up and polish

* Refactor onboarding layout and styles for improved user experience

* updated ghe button

* removed other variations. changed command to Welcome Onboarding 2026

* removed keyboard maps for cursor and windsurf, added more theme options

* added support for other ides

* Add telemetry

* Addressing code review comments

* Remove 2 extension reccs and add setting to control onboarding

* Remove button click from feature cards and update command category

* - Removed the preview properties from IOnboardingThemeOption and related theme options.
- Deleted IOnboardingKeymapOption interface and ONBOARDING_KEYMAP_OPTIONS array.
- Consolidated AI collaboration preferences into a single enum and options array.
- Added new SVG files for theme previews: dark 2026, high contrast dark, high contrast light, light 2026, solarized dark, and solarized light.

* Refine agent sessions step and footer layout

- Rename Background Agents to Copilot CLI
- Move video tutorials link to bottom of content area (above footer)
- Move sign-in nudge button to footer left with visible border
- Remove agents tutorial link and sessions-docs separator
- Add footerLeft container for last-step footer elements
- Remove unused _renderSignInNudge method
- Make doc-link icon inherit link color

* Refactor onboarding service and update startup page

* Resolve merge conflicts, move theme options to product.json, default onboarding setting to false

Agent-Logs-Url: https://github.com/microsoft/vscode/sessions/da410dab-8ffb-4cc5-9afd-6e968b0c5ed6

Co-authored-by: cwebster-99 <60238438+cwebster-99@users.noreply.github.com>

* Update src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts

* Update src/vs/workbench/contrib/welcomeGettingStarted/browser/startupPage.ts

Co-authored-by: Josh Spicer <23246594+joshspicer@users.noreply.github.com>

* Fix timing for onboarding widget on startup

* update distro to microsoft/vscode-distro@84f56fc

* pass --skip-welcome

---------

Co-authored-by: cwebster-99 <cowebster@microsoft.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cwebster-99 <60238438+cwebster-99@users.noreply.github.com>
Co-authored-by: Josh Spicer <23246594+joshspicer@users.noreply.github.com>
* Move IRequestLogger into common

so that it can be used in common files.

also two tiny feedbacks in claude from microsoft#309119

* format
…inal

Characters such as ~, !, #, $, ^, &, *, |, ;, <, > and backtick were
silently stripped from file paths when dragging files from the Explorer
into the terminal. This produced invalid paths pointing to non-existent
files.

The stripping was unnecessary: escapeNonWindowsPath always wraps paths
in shell-appropriate quotes (e.g. single quotes for bash/sh/zsh), inside
which all of those characters are treated as literals and cannot cause
shell injection.

Remove the bannedChars replacement and update the related test to assert
the correct (preserving) behavior.

Fixes microsoft#276999
@yogeshwaran-c
Copy link
Copy Markdown
Owner Author

Re-raised on upstream as microsoft#309187 (this was wrongly targeted at my fork).

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.

Dragging-n-dropping a file with tilde in the name into terminal