Skip to content

Commit 4e868fc

Browse files
authored
feat(utils): update encoding detection and shell allowlist (#596)
1 parent ac8bcf0 commit 4e868fc

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

assets/images/readme/agent.gif

3.09 MB
Loading

assets/images/readme/agent_en.gif

2.63 MB
Loading

src/utils/encoding.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ export async function detectEncoding(fileBuffer: Buffer, fileExtension?: string,
165165
encoding = "utf8"
166166
}
167167

168+
if (encoding === "ascii") {
169+
return "utf8"
170+
}
171+
168172
// 4. Verify if the encoding is supported by iconv-lite
169173
if (!iconv.encodingExists(encoding)) {
170174
createLogger().warn(

src/utils/shell.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const SHELL_ALLOWLIST = new Set<string>([
3838
"C:\\cygwin\\bin\\bash.exe",
3939

4040
// Unix/Linux/macOS - Bourne-compatible shells
41+
"bash",
4142
"/bin/sh",
4243
"/usr/bin/sh",
4344
"/bin/bash",
@@ -47,6 +48,7 @@ const SHELL_ALLOWLIST = new Set<string>([
4748
"/opt/local/bin/bash",
4849

4950
// Z Shell
51+
"zsh",
5052
"/bin/zsh",
5153
"/usr/bin/zsh",
5254
"/usr/local/bin/zsh",

0 commit comments

Comments
 (0)