Skip to content

Commit

Permalink
refactor: pass escaped URL instead of path
Browse files Browse the repository at this point in the history
The constructor functions of the Importer structs expect an escaped URL
as argument but received only the escaped path.
  • Loading branch information
nikoksr committed Feb 17, 2020
1 parent c53d057 commit 1fc8387
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/proji/storage/item/class.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ func (c *Class) ImportFromURL(URL string) error {
func (c *Class) getRepoTree(url *url.URL) error {
var r repo.Importer
var err error
escapedURLPath := url.EscapedPath()
escapedURL := url.Hostname() + url.EscapedPath()

// Handle different platforms
switch url.Hostname() {
case "github.com":
r, err = github.New(escapedURLPath)
r, err = github.New(escapedURL)
case "gitlab.com":
r, err = gitlab.New(escapedURLPath)
r, err = gitlab.New(escapedURL)
default:
return fmt.Errorf("platform not supported yet")
}
Expand Down

0 comments on commit 1fc8387

Please sign in to comment.