Initial open source release

This commit is contained in:
Ronni Skansing
2025-08-21 16:14:09 +02:00
commit 11cf01f08e
488 changed files with 97180 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
package utils
import "path/filepath"
// GetSafePathWithinRoot returns a safe path within a root
// safeRootPath is the root directory and must be a SAFE string
// unsafePath is the path to be joined to the root and can be UNSAFE string
// example: GetSafePathWithinRoot("/home/user", "../etc/passwd") returns "/home/user/etc/passwd"
func GetSafePathWithinRoot(safeRootPath, unsafePath string) string {
return filepath.Join(safeRootPath, filepath.Clean("/"+unsafePath))
}