Merge pull request #4740 from zh199225/develop
set a default value "/" for "Path" in the Cookie function when there is not parameter "Path" or the parameter is ""
This commit is contained in:
commit
745dcf1ead
@ -58,8 +58,8 @@
|
|||||||
- Refactor: Move `BindXXX` and `XXXResp` methods to `context.Context`. [4718](https://github.com/beego/beego/pull/4718)
|
- Refactor: Move `BindXXX` and `XXXResp` methods to `context.Context`. [4718](https://github.com/beego/beego/pull/4718)
|
||||||
- Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737)
|
- Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737)
|
||||||
- fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715)
|
- fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715)
|
||||||
- Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735)
|
- Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735) [4739](https://github.com/beego/beego/issues/4739)
|
||||||
- Fix 4734: do not reset id in Delete function. [4738](https://github.com/beego/beego/pull/4738)
|
- Fix 4734: do not reset id in Delete function. [4738](https://github.com/beego/beego/pull/4738) [4742](https://github.com/beego/beego/pull/4742)
|
||||||
|
|
||||||
## Fix Sonar
|
## Fix Sonar
|
||||||
|
|
||||||
|
|||||||
@ -715,13 +715,6 @@ func (d *dbBase) Delete(ctx context.Context, q dbQuerier, mi *modelInfo, ind ref
|
|||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if num > 0 {
|
if num > 0 {
|
||||||
if mi.fields.pk.auto {
|
|
||||||
if mi.fields.pk.fieldType&IsPositiveIntegerField > 0 {
|
|
||||||
ind.FieldByIndex(mi.fields.pk.fieldIndex).SetUint(0)
|
|
||||||
} else {
|
|
||||||
ind.FieldByIndex(mi.fields.pk.fieldIndex).SetInt(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err := d.deleteRels(ctx, q, mi, args, tz)
|
err := d.deleteRels(ctx, q, mi, args, tz)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return num, err
|
return num, err
|
||||||
|
|||||||
@ -2403,8 +2403,10 @@ func TestReadOrCreate(t *testing.T) {
|
|||||||
throwFail(t, AssertIs(nu.Status, u.Status))
|
throwFail(t, AssertIs(nu.Status, u.Status))
|
||||||
throwFail(t, AssertIs(nu.IsStaff, u.IsStaff))
|
throwFail(t, AssertIs(nu.IsStaff, u.IsStaff))
|
||||||
throwFail(t, AssertIs(nu.IsActive, u.IsActive))
|
throwFail(t, AssertIs(nu.IsActive, u.IsActive))
|
||||||
|
assert.True(t, u.ID > 0)
|
||||||
|
|
||||||
dORM.Delete(u)
|
dORM.Delete(u)
|
||||||
|
assert.True(t, u.ID > 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInLine(t *testing.T) {
|
func TestInLine(t *testing.T) {
|
||||||
|
|||||||
@ -118,13 +118,13 @@ func (output *BeegoOutput) Cookie(name string, value string, others ...interface
|
|||||||
// can use nil skip set
|
// can use nil skip set
|
||||||
|
|
||||||
// default "/"
|
// default "/"
|
||||||
|
tmpPath := "/"
|
||||||
if len(others) > 1 {
|
if len(others) > 1 {
|
||||||
if v, ok := others[1].(string); ok && len(v) > 0 {
|
if v, ok := others[1].(string); ok && len(v) > 0 {
|
||||||
fmt.Fprintf(&b, "; Path=%s", sanitizeValue(v))
|
tmpPath = sanitizeValue(v)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fmt.Fprintf(&b, "; Path=%s", "/")
|
|
||||||
}
|
}
|
||||||
|
fmt.Fprintf(&b, "; Path=%s", tmpPath)
|
||||||
|
|
||||||
// default empty
|
// default empty
|
||||||
if len(others) > 2 {
|
if len(others) > 2 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user