github.com/rajatvaryani/mattermost-server@v5.11.1+incompatible/utils/path.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package utils
     5  
     6  import (
     7  	"path/filepath"
     8  	"strings"
     9  )
    10  
    11  // PathTraversesUpward will return true if the path attempts to traverse upwards by using
    12  // ".." in the path.
    13  func PathTraversesUpward(path string) bool {
    14  	return strings.HasPrefix(filepath.Clean(path), "..")
    15  }