Initial QSfera import
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package filepathx
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// JailJoin joins any number of path elements into a single path,
|
||||
// it protects against directory traversal by removing any "../" elements
|
||||
// and ensuring that the path is always under the jail.
|
||||
func JailJoin(jail string, elem ...string) string {
|
||||
return filepath.Join(jail, filepath.Join(append([]string{"/"}, elem...)...))
|
||||
}
|
||||
Reference in New Issue
Block a user