Skip to content

Commit 126dc1c

Browse files
committed
internal/devbox: handle whitespace in paths
Make sure the flake ref is URL-encoded and quote the rcfile in the shellrc template. Fixes #2290.
1 parent f8f5511 commit 126dc1c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

internal/devbox/shellrc.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ working_dir="$(pwd)"
5656
cd "{{ .ProjectDir }}" || exit
5757

5858
# Source the hooks file, which contains the project's init hooks and plugin hooks.
59-
. {{ .HooksFilePath }}
59+
. "{{ .HooksFilePath }}"
6060

6161
cd "$working_dir" || exit
6262

internal/nix/nix.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"go.jetpack.io/devbox/internal/boxcli/featureflag"
2424
"go.jetpack.io/devbox/internal/boxcli/usererr"
2525
"go.jetpack.io/devbox/internal/redact"
26+
"go.jetpack.io/devbox/nix/flake"
2627
"golang.org/x/mod/semver"
2728

2829
"go.jetpack.io/devbox/internal/debug"
@@ -73,13 +74,14 @@ func (*Nix) PrintDevEnv(ctx context.Context, args *PrintDevEnvArgs) (*PrintDevEn
7374
if err != nil {
7475
return nil, errors.WithStack(err)
7576
}
77+
ref := flake.Ref{Type: flake.TypePath, Path: flakeDirResolved}
7678

7779
if len(data) == 0 {
7880
cmd := command("print-dev-env", "--json")
7981
if featureflag.ImpurePrintDevEnv.Enabled() {
8082
cmd.Args = append(cmd.Args, "--impure")
8183
}
82-
cmd.Args = append(cmd.Args, "path:"+flakeDirResolved)
84+
cmd.Args = append(cmd.Args, ref)
8385
slog.Debug("running print-dev-env cmd", "cmd", cmd)
8486
data, err = cmd.Output(ctx)
8587
if insecure, insecureErr := IsExitErrorInsecurePackage(err, "" /*pkgName*/, "" /*installable*/); insecure {

0 commit comments

Comments
 (0)