Skip to content

Commit

Permalink
use path.IsAbs/path.Join to build absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
drakkan committed Sep 21, 2022
1 parent eb9e6b0 commit f289aa0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handle_dirs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ var errFileList = errors.New("listing a file isn't allowed")
var supportedlistArgs = []string{"-al", "-la", "-a", "-l"}

func (c *clientHandler) absPath(p string) string {
if strings.HasPrefix(p, "/") {
if path.IsAbs(p) {
return path.Clean(p)
}

return path.Clean(c.Path() + "/" + p)
return path.Join(c.Path(), p)
}

// getRelativePath returns the specified path as relative to the
Expand Down

0 comments on commit f289aa0

Please sign in to comment.