pass code static-check

This commit is contained in:
liuwei 2018-10-29 15:39:43 +08:00
parent 3fc94b13a0
commit 1553b8c132

View file

@ -55,7 +55,7 @@ local function parse_cookie_expires(expires)
elseif unit == "s" then elseif unit == "s" then
return time return time
else else
return nil, string.format("the unit of expires (%s) is wrong, validated unit includes: y, M, w, d, h, m and s", expires) return nil, string.format("the unit of expires (%s) is wrong", expires)
end end
end end
@ -73,8 +73,9 @@ local function set_cookie(self, value)
httponly = true, httponly = true,
} }
local expires
if self.cookie_expires then if self.cookie_expires then
local expires, err = parse_cookie_expires(self.cookie_expires) expires, err = parse_cookie_expires(self.cookie_expires)
if err then if err then
ngx.log(ngx.WARN, string.format("error when parsing cookie expires: %s, ignoring it", tostring(err))) ngx.log(ngx.WARN, string.format("error when parsing cookie expires: %s, ignoring it", tostring(err)))
else else