Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions pkg/devfile/parser/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"net/url"
"os"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/devfile/parser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down