mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-10 03:13:50 +02:00
refactor: clean up code and enhance utilities with new functions
This commit is contained in:
11
internal/utils/strutils/filepath.go
Normal file
11
internal/utils/strutils/filepath.go
Normal file
@@ -0,0 +1,11 @@
|
||||
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, "..")
|
||||
}
|
||||
Reference in New Issue
Block a user