| 12345678910111213141516171819202122232425262728 | package utilsimport (	"path/filepath"	"strings")// IsFileInputValid returns true this is a valid file name.// This method must be used before joining a file name, generally provided as// user input, with a directoryfunc IsFileInputValid(fileInput string) bool {	cleanInput := filepath.Clean(fileInput)	if cleanInput == "." || cleanInput == ".." {		return false	}	return true}// IsStringPrefixInSlice searches a string prefix in a slice and returns true// if a matching prefix is foundfunc IsStringPrefixInSlice(obj string, list []string) bool {	for _, v := range list {		if strings.HasPrefix(obj, v) {			return true		}	}	return false}
 |