fix/bug: infinite loop non-existent input dir path
Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package input
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@@ -31,6 +32,11 @@ var dirCmd = &cobra.Command{
|
||||
lg.Fatal().Err(err).Str("path", args[1]).Msg("unable to resolve path")
|
||||
}
|
||||
|
||||
// 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")
|
||||
}
|
||||
|
||||
workspace := common.CurrentWorkspace(ctx)
|
||||
if !strings.HasPrefix(p, workspace.Path) {
|
||||
lg.Fatal().Err(err).Str("path", args[1]).Msg("dir is outside the workspace")
|
||||
|
Reference in New Issue
Block a user