Update upload.go

This commit is contained in:
ZizzyDizzyMC 2021-02-22 00:20:55 -05:00
parent 605773decc
commit 2f2470220d
1 changed files with 5 additions and 4 deletions

View File

@ -320,15 +320,16 @@ func processUpload(upReq UploadRequest) (upload Upload, err error) {
// Get the rest of the metadata needed for storage // Get the rest of the metadata needed for storage
var fileExpiry time.Time var fileExpiry time.Time
maxDurationTime := time.Duration(Config.maxDurationTime)
if upReq.expiry == 0 { if upReq.expiry == 0 {
if upReq.size > Config.maxDurationSize && Config.maxDurationTime > 0 { if upReq.size > Config.maxDurationSize && maxDurationTime > 0 {
fileExpiry = time.Now().Add(Config.maxDurationTime) fileExpiry = time.Now().Add(maxDurationTime)
} else { } else {
fileExpiry = expiry.NeverExpire fileExpiry = expiry.NeverExpire
} }
} else { } else {
if upReq.size > Config.maxDurationSize && upReq.expiry > Config.maxDurationTime { if upReq.size > Config.maxDurationSize && upReq.expiry > CmaxDurationTime {
fileExpiry = time.Now().Add(Config.maxDurationTime) fileExpiry = time.Now().Add(maxDurationTime)
} else { } else {
fileExpiry = time.Now().Add(upReq.expiry) fileExpiry = time.Now().Add(upReq.expiry)
} }