Skip to content

Commit

Permalink
path.Join("/", p) handles all the cases already being checked for and…
Browse files Browse the repository at this point in the history
… does a clean
  • Loading branch information
David Lawrence committed May 6, 2015
1 parent 0fcbe88 commit 7b2ee70
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 7b2ee70

Please sign in to comment.