From 7ad86fe212a2973fd0fafc0befa212dede337c06 Mon Sep 17 00:00:00 2001 From: Stephanie Date: Tue, 30 Mar 2021 16:31:57 -0400 Subject: [PATCH] remove adding file name Signed-off-by: Stephanie --- pkg/devfile/parser/context/context.go | 13 +------------ pkg/devfile/parser/parse_test.go | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/pkg/devfile/parser/context/context.go b/pkg/devfile/parser/context/context.go index 327fc433..2625d0fa 100644 --- a/pkg/devfile/parser/context/context.go +++ b/pkg/devfile/parser/context/context.go @@ -4,7 +4,6 @@ import ( "fmt" "net/url" "os" - "path" "path/filepath" "strings" @@ -104,20 +103,10 @@ func (d *DevfileCtx) Populate() (err error) { // PopulateFromURL fills the DevfileCtx struct with relevant context info func (d *DevfileCtx) PopulateFromURL() (err error) { - u, err := url.ParseRequestURI(d.url) + _, err = url.ParseRequestURI(d.url) if err != nil { return err } - if !strings.HasSuffix(d.url, ".yaml") { - u.Path = path.Join(u.Path, "devfile.yaml") - if _, err = util.DownloadFileInMemory(u.String()); err != nil { - u.Path = path.Join(path.Dir(u.Path), ".devfile.yaml") - if _, err = util.DownloadFileInMemory(u.String()); err != nil { - return fmt.Errorf("the provided url is not a valid yaml filepath, and devfile.yaml or .devfile.yaml not found in the provided path : %s", d.url) - } - } - d.url = u.String() - } if d.uriMap == nil { d.uriMap = make(map[string]bool) } diff --git a/pkg/devfile/parser/parse_test.go b/pkg/devfile/parser/parse_test.go index 164b9ea7..3145a176 100644 --- a/pkg/devfile/parser/parse_test.go +++ b/pkg/devfile/parser/parse_test.go @@ -2390,7 +2390,7 @@ func Test_parseParentAndPlugin_RecursivelyReference_withMultipleURI(t *testing.T defer testServer3.Close() t.Run("it should error out if URI is recursively referenced with multiple references", func(t *testing.T) { err := parseParentAndPlugin(devFileObj) - expectedErr := fmt.Sprintf("URI %v%v/devfile.yaml is recursively referenced", httpPrefix, uri1) + expectedErr := fmt.Sprintf("URI %v%v is recursively referenced", httpPrefix, uri1) // Unexpected error if err == nil || !reflect.DeepEqual(expectedErr, err.Error()) { t.Errorf("Test_parseParentAndPlugin_RecursivelyReference_withMultipleURI() unexpected error = %v", err)