Skip to content

Commit 18cfa10

Browse files
committed
small sanity check
1 parent 5501e3e commit 18cfa10

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/utils/utils.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,16 @@ func GetExpirationNum(val interface{}) int32 {
169169
num = int32(val.(float64))
170170
case string:
171171
expiration := val.(string)
172+
if len(expiration) == 0 {
173+
return 0
174+
}
172175
match := regexExpiration.FindStringSubmatch(expiration)
173176
// expiration format: 10d, 10h, 10m, 10s
174177
if len(match) == 2 {
175178
num = Atoi(match[1])
176179
} else {
177180
if len(match) != 3 {
178-
log.Printf("failed to parse expiration value: %s", expiration)
181+
log.Printf("Failed to parse expiration value: %s", expiration)
179182
return 0
180183
}
181184
numStr := match[1]

0 commit comments

Comments
 (0)