Fix logic with set attributes if not set from header
- if NOT set Filename from header - set from multipart/form - if NOT set Timestamp from header and enabled by settings - set current timestamp Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
parent
ec70bfa4cc
commit
71999a796d
1 changed files with 2 additions and 2 deletions
|
@ -116,7 +116,7 @@ func (a *app) upload(c *fasthttp.RequestCtx) {
|
|||
}
|
||||
|
||||
// sets FileName attribute if it wasn't set from header
|
||||
if _, ok := filtered[object.AttributeFileName]; ok {
|
||||
if _, ok := filtered[object.AttributeFileName]; !ok {
|
||||
filename := object.NewAttribute()
|
||||
filename.SetKey(object.AttributeFileName)
|
||||
filename.SetValue(name)
|
||||
|
@ -125,7 +125,7 @@ func (a *app) upload(c *fasthttp.RequestCtx) {
|
|||
}
|
||||
|
||||
// sets Timestamp attribute if it wasn't set from header and enabled by settings
|
||||
if _, ok := filtered[object.AttributeTimestamp]; ok && a.enableDefaultTimestamp {
|
||||
if _, ok := filtered[object.AttributeTimestamp]; !ok && a.enableDefaultTimestamp {
|
||||
timestamp := object.NewAttribute()
|
||||
timestamp.SetKey(object.AttributeTimestamp)
|
||||
timestamp.SetValue(strconv.FormatInt(time.Now().Unix(), 10))
|
||||
|
|
Loading…
Reference in a new issue