Skip to content

Commit 75ab7bb

Browse files
committed
fix downloadAnalyzerSpec function too
1 parent 9692d5a commit 75ab7bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/troubleshoot/cli/analyze.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"os"
99

10+
"github.com/replicatedhq/troubleshoot/cmd/util"
1011
analyzer "github.com/replicatedhq/troubleshoot/pkg/analyze"
1112
"github.com/replicatedhq/troubleshoot/pkg/convert"
1213
"github.com/replicatedhq/troubleshoot/pkg/logger"
@@ -83,7 +84,8 @@ func Analyze() *cobra.Command {
8384

8485
func downloadAnalyzerSpec(specPath string) (string, error) {
8586
specContent := ""
86-
if !isURL(specPath) {
87+
var err error
88+
if _, err = os.Stat(specPath); err == nil {
8789
if _, err := os.Stat(specPath); os.IsNotExist(err) {
8890
return "", fmt.Errorf("%s was not found", specPath)
8991
}
@@ -95,6 +97,10 @@ func downloadAnalyzerSpec(specPath string) (string, error) {
9597

9698
specContent = string(b)
9799
} else {
100+
if !util.IsURL(specPath) {
101+
return "", fmt.Errorf("%s is not a URL and was not found (err %s)", specPath, err)
102+
}
103+
98104
req, err := http.NewRequest("GET", specPath, nil)
99105
if err != nil {
100106
return "", err

0 commit comments

Comments
 (0)