Merge pull request #1019 from grouville/fix/edit-dir
Fix/dagger edit: wrong dir Path leads to infinite loop
This commit is contained in:
commit
6a663c5c0a
@ -34,7 +34,7 @@ var dirCmd = &cobra.Command{
|
||||
|
||||
// Check that directory exists
|
||||
if _, err := os.Stat(p); os.IsNotExist(err) {
|
||||
lg.Fatal().Err(err).Str("path", args[1]).Msg("dir doesn't exists")
|
||||
lg.Fatal().Err(err).Str("path", args[1]).Msg("dir doesn't exist")
|
||||
}
|
||||
|
||||
project := common.CurrentProject(ctx)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -113,6 +114,10 @@ func (dir dirInput) Compile(_ string, state *State) (*compiler.Value, error) {
|
||||
if !strings.HasPrefix(p, state.Project) {
|
||||
return nil, fmt.Errorf("%q is outside the project", dir.Path)
|
||||
}
|
||||
// Check that directory exists
|
||||
if _, err := os.Stat(p); os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("%q dir doesn't exist", dir.Path)
|
||||
}
|
||||
|
||||
llb := fmt.Sprintf(
|
||||
`#up: [{do:"local",dir:"%s", include:%s, exclude:%s}]`,
|
||||
|
@ -320,7 +320,7 @@ setup() {
|
||||
|
||||
run "$DAGGER" input dir src xxx -e "input"
|
||||
assert_failure
|
||||
assert_output --partial "dir doesn't exists"
|
||||
assert_output --partial "dir doesn't exist"
|
||||
}
|
||||
|
||||
@test "dagger input dir: ignore .dagger" {
|
||||
|
Reference in New Issue
Block a user