Skip to content

Commit

Permalink
File Explorer: Fix issue with spaces in filenames (#277)
Browse files Browse the repository at this point in the history
We were escaping spaces while using that value directly in SFTP calls.
This caused the escape character (`\`) to be included in the
file/directory name. Additionally, if a space was included it would not
be able to be deleted as it would issue the delete call to include the
escape character.

Closes #231

Signed-off-by: Tyler Smalley <tyler@tailscale.com>
  • Loading branch information
tylersmalley committed Nov 21, 2023
1 parent de645ae commit 736985d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion src/filesystem-provider-ssh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { exec } from 'child_process';
import { Logger } from './logger';
import { SSH } from './ssh';
import { ConfigManager } from './config-manager';
import { escapeSpace } from './utils/string';
import { parseTsUri } from './utils/uri';
import { fileSorter } from './filesystem-provider';

Expand Down
3 changes: 1 addition & 2 deletions src/utils/uri.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Uri } from 'vscode';
import { escapeSpace } from './string';

export interface TsUri {
address: string;
Expand Down Expand Up @@ -34,7 +33,7 @@ export function parseTsUri(uri: Uri): TsUri {
let resourcePath = decodeURIComponent(pathSegments.join('/'));

if (!resourcePath.startsWith('.')) {
resourcePath = `/${escapeSpace(resourcePath)}`;
resourcePath = `/${resourcePath}`;
}

return { address, tailnet: uri.authority, resourcePath };
Expand Down

0 comments on commit 736985d

Please sign in to comment.