From 6bdb091a92cfc8b60f40bd2e5dc6f0ad86d11129 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Wed, 27 Apr 2016 15:10:36 +0300 Subject: [PATCH] extend support for *unlimited in expiration time --- utils/coreutils.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/coreutils.go b/utils/coreutils.go index 461fb2d98..abdbc1fa7 100644 --- a/utils/coreutils.go +++ b/utils/coreutils.go @@ -127,8 +127,9 @@ func Round(x float64, prec int, method string) float64 { } func ParseTimeDetectLayout(tmStr string, timezone string) (time.Time, error) { + tmStr = strings.TrimSpace(tmStr) var nilTime time.Time - if len(tmStr) == 0 { + if len(tmStr) == 0 || tmStr == UNLIMITED { return nilTime, nil } loc, err := time.LoadLocation(timezone) @@ -179,7 +180,7 @@ func ParseTimeDetectLayout(tmStr string, timezone string) (time.Time, error) { func ParseDate(date string) (expDate time.Time, err error) { date = strings.TrimSpace(date) switch { - case date == "*unlimited" || date == "": + case date == UNLIMITED || date == "": // leave it at zero case strings.HasPrefix(date, "+"): d, err := time.ParseDuration(date[1:])