Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
Fix path parsing with http routes (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhaj10p authored and anweiss committed Jan 25, 2019
1 parent d46aa13 commit b513c89
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions generator/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,22 @@ func AppendAlterations(p *profile.Profile) (*profile.Profile, error) {
func SetBasePath(p *profile.Profile, parentPath string) (*profile.Profile, error) {

for i, x := range p.Imports {

if x.Href == nil {
return nil, fmt.Errorf("href cannot be nil")
}
uri, err := url.Parse(x.Href.String())
if err != nil {
return nil, fmt.Errorf("failed to parse url: %s", err)
}
if isHTTPResource(uri) {
continue
}
path := fmt.Sprintf("%s/%s", path.Dir(parentPath), path.Base(x.Href.String()))
path, err := filepath.Abs(path)
path, err = filepath.Abs(path)
if err != nil {
return nil, err
}
uri, err := url.Parse(path)
uri, err = url.Parse(path)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b513c89

Please sign in to comment.