fix(ftp): resolve LuaLS type warnings in curl wrapper and parse_unix_list_line
This commit is contained in:
parent
395614a037
commit
12881fb23d
1 changed files with 15 additions and 9 deletions
|
|
@ -165,7 +165,7 @@ end
|
||||||
---@param cb? fun(err: nil|string, output: nil|string[])
|
---@param cb? fun(err: nil|string, output: nil|string[])
|
||||||
local function curl(url, extra_args, opts, cb)
|
local function curl(url, extra_args, opts, cb)
|
||||||
if not cb then
|
if not cb then
|
||||||
cb = opts
|
cb = opts --[[@as fun(err: nil|string, output: nil|string[])]]
|
||||||
opts = {}
|
opts = {}
|
||||||
end
|
end
|
||||||
local cmd = { 'curl', '-sS', '--netrc-optional' }
|
local cmd = { 'curl', '-sS', '--netrc-optional' }
|
||||||
|
|
@ -239,26 +239,32 @@ local function parse_unix_list_line(line)
|
||||||
mtime = os.time({
|
mtime = os.time({
|
||||||
year = t.year,
|
year = t.year,
|
||||||
month = mon,
|
month = mon,
|
||||||
day = tonumber(day),
|
day = tonumber(day) or 0,
|
||||||
hour = tonumber(hour),
|
hour = tonumber(hour) or 0,
|
||||||
min = tonumber(min),
|
min = tonumber(min) or 0,
|
||||||
sec = 0,
|
sec = 0,
|
||||||
})
|
})
|
||||||
if mtime > now + 86400 then
|
if mtime > now + 86400 then
|
||||||
mtime = os.time({
|
mtime = os.time({
|
||||||
year = t.year - 1,
|
year = t.year - 1,
|
||||||
month = mon,
|
month = mon,
|
||||||
day = tonumber(day),
|
day = tonumber(day) or 0,
|
||||||
hour = tonumber(hour),
|
hour = tonumber(hour) or 0,
|
||||||
min = tonumber(min),
|
min = tonumber(min) or 0,
|
||||||
sec = 0,
|
sec = 0,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local year = tonumber(timeoryear)
|
local year = tonumber(timeoryear)
|
||||||
if year then
|
if year then
|
||||||
mtime =
|
mtime = os.time({
|
||||||
os.time({ year = year, month = mon, day = tonumber(day), hour = 0, min = 0, sec = 0 })
|
year = year,
|
||||||
|
month = mon,
|
||||||
|
day = tonumber(day) or 0,
|
||||||
|
hour = 0,
|
||||||
|
min = 0,
|
||||||
|
sec = 0,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue