mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-21 06:35:08 +00:00
revel/revel#1014 added check for path like ../dir & ./dir for new command
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/revel/revel"
|
"github.com/revel/revel"
|
||||||
)
|
)
|
||||||
@@ -111,7 +112,11 @@ func initGoPaths() {
|
|||||||
func setApplicationPath(args []string) {
|
func setApplicationPath(args []string) {
|
||||||
var err error
|
var err error
|
||||||
importPath = args[0]
|
importPath = args[0]
|
||||||
if filepath.IsAbs(importPath) {
|
|
||||||
|
// revel/revel#1014 validate relative path, we cannot use built-in functions
|
||||||
|
// since Go import path is valid relative path too.
|
||||||
|
// so check basic part of the path, which is "."
|
||||||
|
if filepath.IsAbs(importPath) || strings.HasPrefix(importPath, ".") {
|
||||||
errorf("Abort: '%s' looks like a directory. Please provide a Go import path instead.",
|
errorf("Abort: '%s' looks like a directory. Please provide a Go import path instead.",
|
||||||
importPath)
|
importPath)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user