Skip to content

Commit

Permalink
path.Join("/") does everything required in Normalize
Browse files Browse the repository at this point in the history
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
  • Loading branch information
David Lawrence committed May 6, 2015
1 parent 0fcbe88 commit ae493bc
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"io"
"io/ioutil"
"path"
"strings"

"github.com/flynn/go-tuf/data"
)
Expand Down Expand Up @@ -105,14 +104,7 @@ func GenerateFileMeta(r io.Reader, hashAlgorithms ...string) (data.FileMeta, err
}

func NormalizeTarget(p string) string {
if p == "" {
return "/"
}
s := path.Clean(p)
if strings.HasPrefix(s, "/") {
return s
}
return "/" + s
return path.Join("/", p)
}

func HashedPaths(p string, hashes data.Hashes) []string {
Expand Down

0 comments on commit ae493bc

Please sign in to comment.