From 15494d4ebc734f3585218682ba4eed40f7cb20ef Mon Sep 17 00:00:00 2001 From: Ivan Naidenov Date: Thu, 18 Jul 2019 02:32:32 +0300 Subject: Fix zero values in ziptime (#1056) If the rock was packed with luarocks then the time in it is set to zeros and this is not the case with the unix format can be removed when date given is added to zipwriter_open_new_file_in_zip --- src/luarocks/tools/zip.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/luarocks/tools/zip.lua b/src/luarocks/tools/zip.lua index 5974c7bf..f08162c5 100644 --- a/src/luarocks/tools/zip.lua +++ b/src/luarocks/tools/zip.lua @@ -306,7 +306,7 @@ end local function ziptime_to_luatime(ztime, zdate) - return { + local date = { year = shr(zdate, 9) + 1980, month = shr(lowbits(zdate, 9), 5), day = lowbits(zdate, 5), @@ -314,6 +314,11 @@ local function ziptime_to_luatime(ztime, zdate) min = shr(lowbits(ztime, 11), 5), sec = lowbits(ztime, 5) * 2, } + + if date.month == 0 then date.month = 1 end + if date.day == 0 then date.day = 1 end + + return date end local function read_file_in_zip(zh, cdr) -- cgit v1.2.3-55-g6feb