Skip to content

fix: SSHConfig: check for multiple start/end blocks #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! add config file path to message
  • Loading branch information
johnstcn committed May 21, 2025
commit e65ee216dd8131faf6d7ddd41e6568b50cd9e3e6
10 changes: 6 additions & 4 deletions src/sshConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ Host afterconfig
LogLevel: "ERROR",
}),
).rejects.toThrow(
`Malformed config: Unterminated START CODER VSCODE dev.coder.com block: Each START block must have an END block.`,
`Malformed config: ${sshFilePath} has an unterminated START CODER VSCODE dev.coder.com block. Each START block must have an END block.`,
)
})

Expand Down Expand Up @@ -338,7 +338,7 @@ Host afterconfig
LogLevel: "ERROR",
}),
).rejects.toThrow(
`Malformed config: Unterminated START CODER VSCODE dev.coder.com block: Each START block must have an END block.`,
`Malformed config: ${sshFilePath} has an unterminated START CODER VSCODE dev.coder.com block. Each START block must have an END block.`,
)
})

Expand Down Expand Up @@ -388,7 +388,9 @@ Host afterconfig
UserKnownHostsFile: "/dev/null",
LogLevel: "ERROR",
}),
).rejects.toThrow(`Malformed config: Unterminated START CODER VSCODE block: Each START block must have an END block.`)
).rejects.toThrow(
`Malformed config: ${sshFilePath} has an unterminated START CODER VSCODE block. Each START block must have an END block.`,
)
})

it("throws an error if there are more than one sections with the same label", async () => {
Expand Down Expand Up @@ -437,7 +439,7 @@ Host afterconfig
LogLevel: "ERROR",
}),
).rejects.toThrow(
`Malformed config: ssh config has 2 START CODER VSCODE dev.coder.com sections, please remove all but one.`,
`Malformed config: ${sshFilePath} has 2 START CODER VSCODE dev.coder.com sections. Please remove all but one.`,
)
})

Expand Down