fix(cli): add missing shell metacharacters (\n, \r, \t, \\) to escape regex

This commit is contained in:
MD. MOHIBUR RAHMAN
2026-02-24 04:14:54 +06:00
parent 926afab788
commit 5b3819073f
2 changed files with 8 additions and 1 deletions
@@ -156,6 +156,13 @@ describe('useShellCompletion utilities', () => {
expect(escapeShellPath('normal-file.txt')).toBe('normal-file.txt');
});
it('should escape tabs, newlines, carriage returns, and backslashes', () => {
expect(escapeShellPath('a\tb')).toBe('a\\\tb');
expect(escapeShellPath('a\nb')).toBe('a\\\nb');
expect(escapeShellPath('a\rb')).toBe('a\\\rb');
expect(escapeShellPath('a\\b')).toBe('a\\\\b');
});
it('should handle empty string', () => {
expect(escapeShellPath('')).toBe('');
});