1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-12 11:50:40 +00:00

Move many PR's change here since the original authors are responseless

This commit is contained in:
Ming Deng
2020-06-23 21:18:58 +08:00
parent 96658121dc
commit 3ce68d6a30
5 changed files with 73 additions and 43 deletions

View File

@ -129,8 +129,9 @@ func (fp *FileProvider) SessionInit(maxlifetime int64, savePath string) error {
// if file is not exist, create it.
// the file path is generated from sid string.
func (fp *FileProvider) SessionRead(sid string) (Store, error) {
if strings.ContainsAny(sid, "./") {
return nil, nil
invalidChars := "./"
if strings.ContainsAny(sid, invalidChars) {
return nil, errors.New("the sid shouldn't have following characters: " + invalidChars)
}
if len(sid) < 2 {
return nil, errors.New("length of the sid is less than 2")