Skip to content

Fix: space escaping in path#5

Open
nani-samireddy wants to merge 1 commit intomainfrom
dev
Open

Fix: space escaping in path#5
nani-samireddy wants to merge 1 commit intomainfrom
dev

Conversation

@nani-samireddy
Copy link
Owner

@nani-samireddy nani-samireddy commented Aug 8, 2025

Description

This PR updates the command path escaping logic in src/extension.ts:

  • Improved Path Handling:
    Previously, the path was escaped by replacing single quotes but did not account for any pre-existing escaped spaces (\ ) in the path string.
    Now, before escaping single quotes, the code first replaces all escaped spaces (\ ) with regular spaces. This ensures the path used for the terminal command is correctly quoted and does not contain redundant backslashes.
- const escapedPath = `'${selected.description.replace(
+ const pathWithoutSpaceEscapes = selected.description.replace(/\\ /g, ' ');
+ const escapedPath = `'${pathWithoutSpaceEscapes.replace(
    /'/g,
    "'\\''"
  )}'`;

Why?

  • Fixes issues where file paths with spaces were incorrectly handled, leading to potential command failures in the integrated terminal.
  • Makes command invocation more robust for file/folder names that contain spaces and/or single quotes.

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.

1 participant