Skip to content

Commit 85a331e

Browse files
authored
Merge pull request #77 from yangcao77/398-restictURI
remove file name addition to URL
2 parents dbd2039 + 7ad86fe commit 85a331e

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

pkg/devfile/parser/context/context.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"net/url"
66
"os"
7-
"path"
87
"path/filepath"
98
"strings"
109

@@ -104,20 +103,10 @@ func (d *DevfileCtx) Populate() (err error) {
104103

105104
// PopulateFromURL fills the DevfileCtx struct with relevant context info
106105
func (d *DevfileCtx) PopulateFromURL() (err error) {
107-
u, err := url.ParseRequestURI(d.url)
106+
_, err = url.ParseRequestURI(d.url)
108107
if err != nil {
109108
return err
110109
}
111-
if !strings.HasSuffix(d.url, ".yaml") {
112-
u.Path = path.Join(u.Path, "devfile.yaml")
113-
if _, err = util.DownloadFileInMemory(u.String()); err != nil {
114-
u.Path = path.Join(path.Dir(u.Path), ".devfile.yaml")
115-
if _, err = util.DownloadFileInMemory(u.String()); err != nil {
116-
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)
117-
}
118-
}
119-
d.url = u.String()
120-
}
121110
if d.uriMap == nil {
122111
d.uriMap = make(map[string]bool)
123112
}

pkg/devfile/parser/parse_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ func Test_parseParentAndPlugin_RecursivelyReference_withMultipleURI(t *testing.T
23902390
defer testServer3.Close()
23912391
t.Run("it should error out if URI is recursively referenced with multiple references", func(t *testing.T) {
23922392
err := parseParentAndPlugin(devFileObj)
2393-
expectedErr := fmt.Sprintf("URI %v%v/devfile.yaml is recursively referenced", httpPrefix, uri1)
2393+
expectedErr := fmt.Sprintf("URI %v%v is recursively referenced", httpPrefix, uri1)
23942394
// Unexpected error
23952395
if err == nil || !reflect.DeepEqual(expectedErr, err.Error()) {
23962396
t.Errorf("Test_parseParentAndPlugin_RecursivelyReference_withMultipleURI() unexpected error = %v", err)

0 commit comments

Comments
 (0)