summaryrefslogtreecommitdiffstats
path: root/utils/path.go
blob: 5f921b41d3c33286d68f2142f7102e2bee15cb42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package utils

import (
	"path/filepath"
	"strings"
)

// PathTraversesUpward will return true if the path attempts to traverse upwards by using
// ".." in the path.
func PathTraversesUpward(path string) bool {
	return strings.HasPrefix(filepath.Clean(path), "..")
}