Terminal adds " at the end if a folder contains \ at the end #21059

Open
opened 2026-01-31 07:31:58 +00:00 by claunia · 0 comments
Owner

Originally created by @deadcoder0904 on GitHub (Jan 7, 2024).

Windows Terminal version

Version: 1.18.3181.0

Windows build number

Microsoft Windows [Version 10.0.22621.2861]

Other Software

deno 1.39.2 (release, x86_64-pc-windows-msvc)
v8 12.0.267.8
typescript 5.3.3

Steps to reproduce

Install deno

Paste the following script in a folder that has a subfolder.

doublequote-bug.ts

// Get folder path from Deno.args
const [folderPath] = Deno.args

// Check if folderPath is provided
if (!folderPath) {
	console.error('Please provide the folder path as an argument.')
	Deno.exit(1)
}

const root = folderPath.replace(/"/g, '') // terminal bug that adds " if foldername contains / at the end

console.log({
	folderPath,
	root,
})

Now run it using deno.

Expected Behavior

folderPath shouldn't have " at the end & it should look like root

This only happens when you have \ at the end while calling deno run.

If I remove \ manually after pressing Tab after typing how<Tab>, then both folderPath & root looks same.

PS D:\$$ Tuts> deno run .\doublequote-bug.ts '.\How to make $10k a month on Reddit'
{
  folderPath: ".\\How to make $10k a month on Reddit",
  root: ".\\How to make $10k a month on Reddit"
}

This is a source of many bugs that I faced in python as well as deno so I think it's actually a Terminal bug.

Actual Behavior

Here's what I run & the output I get:

PS D:\$$ Tuts> deno run .\doublequote-bug.ts '.\How to make $10k a month on Reddit\'
{
  folderPath: '.\\How to make $10k a month on Reddit"',
  root: ".\\How to make $10k a month on Reddit"
}

Notice the extra double quote near the end of folderPath

Originally created by @deadcoder0904 on GitHub (Jan 7, 2024). ### Windows Terminal version Version: 1.18.3181.0 ### Windows build number Microsoft Windows [Version 10.0.22621.2861] ### Other Software deno 1.39.2 (release, x86_64-pc-windows-msvc) v8 12.0.267.8 typescript 5.3.3 ### Steps to reproduce Install [deno](https://deno.com/) Paste the following script in a folder that has a subfolder. ### doublequote-bug.ts ```ts // Get folder path from Deno.args const [folderPath] = Deno.args // Check if folderPath is provided if (!folderPath) { console.error('Please provide the folder path as an argument.') Deno.exit(1) } const root = folderPath.replace(/"/g, '') // terminal bug that adds " if foldername contains / at the end console.log({ folderPath, root, }) ``` Now run it using deno. ### Expected Behavior `folderPath` shouldn't have `"` at the end & it should look like `root` This only happens when you have `\` at the end while calling `deno run`. If I remove `\` manually after pressing `Tab` after typing `how<Tab>`, then both `folderPath` & `root` looks same. ```ts PS D:\$$ Tuts> deno run .\doublequote-bug.ts '.\How to make $10k a month on Reddit' { folderPath: ".\\How to make $10k a month on Reddit", root: ".\\How to make $10k a month on Reddit" } ``` This is a source of many bugs that I faced in python as well as deno so I think it's actually a Terminal bug. ### Actual Behavior Here's what I run & the output I get: ```ts PS D:\$$ Tuts> deno run .\doublequote-bug.ts '.\How to make $10k a month on Reddit\' { folderPath: '.\\How to make $10k a month on Reddit"', root: ".\\How to make $10k a month on Reddit" } ``` Notice the extra double quote near the end of `folderPath`
claunia added the Needs-TriageIssue-BugNeeds-Repro labels 2026-01-31 07:31:58 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21059