Skip to content

Commit 807e0de

Browse files
committed
fix: pass non-ASCII terminal env vars through
1 parent 1f157bd commit 807e0de

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Terminal and git env vars are forwarded into the sandbox:
5151

5252
`TERM`, `COLORTERM`, `TERM_PROGRAM`, `TERM_PROGRAM_VERSION`, `NO_COLOR`, `FORCE_COLOR`, `LANG`, `LC_ALL`, `EMAIL`, `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL`, `PI_RUN_CODE_UNSANDBOXED`
5353

54-
Non-ASCII values are filtered out (microsandbox VMM limitation).
54+
Non-ASCII values are passed through as-is.
5555

5656
## API keys
5757

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function termEnv(
4747
}
4848
const result: Record<string, string> = {}
4949
for (const [k, v] of Object.entries(vars)) {
50-
if (v && /^[\x20-\x7E]*$/.test(v)) result[k] = v
50+
if (v) result[k] = v
5151
}
5252
return result
5353
}

test/index.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ describe("termEnv", () => {
5757
expect(v).toBeDefined()
5858
}
5959
})
60+
61+
it("passes non-ASCII values through", () => {
62+
const env = termEnv({
63+
TERM: "xterm",
64+
GIT_AUTHOR_NAME: "Jöhn Müller",
65+
EMAIL: "user@exämple.com",
66+
LANG: "et_EE.UTF-8",
67+
})
68+
expect(env.GIT_AUTHOR_NAME).toBe("Jöhn Müller")
69+
expect(env.EMAIL).toBe("user@exämple.com")
70+
expect(env.LANG).toBe("et_EE.UTF-8")
71+
})
72+
73+
it("passes emoji values through", () => {
74+
const env = termEnv({ TERM: "xterm", COLORTERM: "🎨 truecolor" })
75+
expect(env.COLORTERM).toBe("🎨 truecolor")
76+
})
6077
})
6178

6279
describe("buildSecrets", () => {

0 commit comments

Comments
 (0)