From 71999a796d675ed29a1497f17633d0c503594cb4 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Thu, 28 Jan 2021 16:48:45 +0300 Subject: [PATCH] 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 --- upload.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upload.go b/upload.go index 6d72a61..12111b0 100644 --- a/upload.go +++ b/upload.go @@ -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))