fix(js-sdk): strip quotes from ENV values in fromDockerfile()#1176
fix(js-sdk): strip quotes from ENV values in fromDockerfile()#1176
Conversation
The Dockerfile parser stored ENV values as raw strings without stripping surrounding quotes. This caused ENV GOPATH="/go" to produce "/go" (with literal quote characters) instead of /go. Add a stripQuotes() helper and apply it to all value extraction points in handleEnvInstruction(). Variable expansion is handled by the backend.
|
Package ArtifactsBuilt from 32c7d9a. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.14.2-fix-env-quote-stripping.0.tgzCLI ( npm install ./e2b-cli-2.8.1-fix-env-quote-stripping.0.tgzPython SDK ( pip install ./e2b-2.15.1+fix.env.quote.stripping-py3-none-any.whl |
|
@claude does it need to be changed in Python as well? |
Summary
fromDockerfile()parsesENVinstructions but stores values as raw strings without stripping quotes. This causesENV GOPATH="/go"to produce"/go"(with literal quote characters) instead of/go.Variable expansion (e.g.
${GOPATH}) is handled by the backend, so the SDK only needs to strip quotes.Changes
stripQuotes()helper — removes surrounding"or'from ENV valuesstripQuotes()to all value extraction points inhandleEnvInstruction()Before/After (tested)
ENV GOPATH="/go"/goENV GOPATH='/go'/goENV GOPATH="/go'"/go'(unchanged)ENV GOPATH=/go/go(unchanged)ENV PATH="/usr/bin:${GOPATH}/bin"/usr/bin:${GOPATH}/binENV A="hello" B="world"hello,worldARG MY_ARG="hello"helloARG MY_ARG""Only
packages/js-sdk/src/template/dockerfileParser.tsis modified (+97/-4 lines).Test plan
ENV GOPATH="/go"+RUN test "$GOPATH" = "/go"— build succeeded, confirming quotes are stripped and backend expands variablesfromDockerfile.test.tstests passpnpm run format,pnpm run lint,pnpm run typecheckall pass