Skip to content

Commit 6e608c4

Browse files
committed
fix: propagate os.UserHomeDir() errors in snapshot save and load
snapshot save and load were silently ignoring the error from os.UserHomeDir(), passing an empty home path to ParseSource/ParseDestination when the home directory cannot be resolved. snapshot remove in the same file already handles this correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018kck6rhh1V315WZq943yoZ
1 parent 401d289 commit 6e608c4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

cmd/snapshot.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ func runSnapshotLoad(cfg *env.Env, tel *telemetry.Client, logger log.Logger) fun
209209
return err
210210
}
211211

212-
home, _ := os.UserHomeDir()
212+
home, err := os.UserHomeDir()
213+
if err != nil {
214+
return err
215+
}
213216
src, err := snapshot.ParseSource(args[0], home)
214217
if err != nil {
215218
return err
@@ -419,7 +422,10 @@ func runSnapshotSave(cfg *env.Env) func(*cobra.Command, []string) error {
419422
destArg = args[0]
420423
}
421424

422-
home, _ := os.UserHomeDir()
425+
home, err := os.UserHomeDir()
426+
if err != nil {
427+
return err
428+
}
423429
dest, err := snapshot.ParseDestination(destArg, home, time.Now())
424430
if err != nil {
425431
return err

0 commit comments

Comments
 (0)