Skip to content

Commit

Permalink
fix(new): Take absolute path to body file before loading it in new.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustmop committed Oct 8, 2018
1 parent 2ba07b2 commit b9afcd0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,16 @@ func (o *NewOptions) Run(args []string) (err error) {
dsp.Peername = ref.Peername
}
if o.BodyPath != "" {
if o.BodyPath, err = filepath.Abs(o.BodyPath); err != nil {
dsp.BodyPath = o.BodyPath
}
if dsp.BodyPath != "" {
// Get the absolute path to the body file. Especially important if we are running
// `qri connect` in a different terminal, and that instance is in a different directory;
// that instance won't correctly find the body file we want to load if it's not absolute.
dsp.BodyPath, err = filepath.Abs(dsp.BodyPath)
if err != nil {
return err
}
dsp.BodyPath = o.BodyPath
}
if dsp.Transform != nil {
if o.Secrets != nil {
Expand Down

0 comments on commit b9afcd0

Please sign in to comment.