Skip to content

Commit

Permalink
fix: another try
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhiter committed Oct 28, 2024
1 parent 357c9bc commit 1d6191c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
13 changes: 3 additions & 10 deletions extensions/ide/vscode/devbox/src/commands/remoteConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ const defaultDevboxSSHConfigPath = path.resolve(
)
const defaultSSHKeyPath = path.resolve(os.homedir(), '.ssh/sealos')

function sanitizeInput(input: string) {
const regex = /^[a-zA-Z0-9_\-\/]+$/
if (!regex.test(input)) {
throw new Error('Invalid input')
}
return input
}

export class RemoteSSHConnector extends Disposable {
constructor(context: vscode.ExtensionContext) {
super()
Expand Down Expand Up @@ -227,8 +219,9 @@ export class RemoteSSHConnector extends Disposable {

// create sealos privateKey file in .ssh/sealos
try {
const sshKeyPath = sanitizeInput(
defaultSSHKeyPath + `/${identityFileSSHLabel}`
const sshKeyPath = path.resolve(
defaultSSHKeyPath,
`${identityFileSSHLabel}`
)
fs.writeFileSync(sshKeyPath, normalPrivateKey)

Expand Down
10 changes: 1 addition & 9 deletions extensions/ide/vscode/devbox/src/commands/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import * as vscode from 'vscode'

import { Disposable } from '../common/dispose'

function sanitizeInput(input: string) {
const regex = /^[a-zA-Z0-9_\-\/]+$/
if (!regex.test(input)) {
throw new Error('Invalid input')
}
return input
}

export class Webview extends Disposable {
constructor(context: vscode.ExtensionContext) {
super()
Expand Down Expand Up @@ -39,7 +31,7 @@ export class Webview extends Disposable {
const isProduction =
context.extensionMode === vscode.ExtensionMode.Production
if (isProduction) {
const fileUrl = sanitizeInput(context.extensionPath)
const fileUrl = path.resolve(context.extensionPath)
const filePath = vscode.Uri.file(
path.join(fileUrl, 'dist', 'static/js/main.js')
)
Expand Down

0 comments on commit 1d6191c

Please sign in to comment.