mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
11 lines
352 B
Go
11 lines
352 B
Go
package strutils
|
|
|
|
import "strings"
|
|
|
|
// IsValidFilename checks if a filename is safe and doesn't contain path traversal attempts
|
|
// Returns true if the filename is valid, false otherwise
|
|
func IsValidFilename(filename string) bool {
|
|
return !strings.Contains(filename, "/") &&
|
|
!strings.Contains(filename, "\\") &&
|
|
!strings.Contains(filename, "..")
|
|
}
|