diff --git a/task_test.go b/task_test.go index eea4f854..051e186b 100644 --- a/task_test.go +++ b/task_test.go @@ -1218,6 +1218,10 @@ func TestIncludesRemote(t *testing.T) { firstRemote: srv.URL + "/first/Taskfile.yml", secondRemote: "./second/Taskfile.yml", }, + { + firstRemote: srv.URL + "/first/", + secondRemote: srv.URL + "/first/second/", + }, } tasks := []string{ diff --git a/taskfile/node_http.go b/taskfile/node_http.go index fc905848..55ae08bd 100644 --- a/taskfile/node_http.go +++ b/taskfile/node_http.go @@ -17,9 +17,10 @@ import ( // An HTTPNode is a node that reads a Taskfile from a remote location via HTTP. type HTTPNode struct { *BaseNode - URL *url.URL - logger *logger.Logger - timeout time.Duration + URL *url.URL // stores url pointing actual remote file. (e.g. with Taskfile.yml) + entrypoint string // stores entrypoint url. used for building graph vertices. + logger *logger.Logger + timeout time.Duration } func NewHTTPNode( @@ -40,15 +41,16 @@ func NewHTTPNode( } return &HTTPNode{ - BaseNode: base, - URL: url, - timeout: timeout, - logger: l, + BaseNode: base, + URL: url, + entrypoint: entrypoint, + timeout: timeout, + logger: l, }, nil } func (node *HTTPNode) Location() string { - return node.URL.String() + return node.entrypoint } func (node *HTTPNode) Remote() bool { @@ -119,6 +121,6 @@ func (node *HTTPNode) ResolveDir(dir string) (string, error) { } func (node *HTTPNode) FilenameAndLastDir() (string, string) { - dir, filename := filepath.Split(node.URL.Path) + dir, filename := filepath.Split(node.entrypoint) return filepath.Base(dir), filename }