Skip to content

Commit

Permalink
fix ResolveRelationship linus tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Apr 9, 2019
1 parent 48f4500 commit 02e6933
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions part.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ var defaultRef, _ = url.Parse("http://defaultcontainer/")
// name of the part it targets with respect to the source part.
// The source can be a valid part URI, for part relationships, or "/", for package relationships.
func ResolveRelationship(source string, rel string) string {
if source == "/" || source == "\\" {
return "/" + rel
}
if !strings.HasPrefix(rel, "/") && !strings.HasPrefix(rel, "\\") {
sourceDir := strings.Replace(filepath.Dir(source), "\\", "/", -1)
if sourceDir == "/" {
return "/" + rel
}
return fmt.Sprintf("%s/%s", sourceDir, rel)
}
return rel
Expand Down

0 comments on commit 02e6933

Please sign in to comment.