diff options
author | Peter Melnichenko <mpeterval@gmail.com> | 2016-06-22 20:29:13 +0300 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-06-22 21:30:57 +0300 |
commit | 998fe0b16920f5c8316dadf7d247588a23c36b29 (patch) | |
tree | 4d7c74acb326a8964f34a8a8cc6458f53da80877 | |
parent | 1138929e64fb9d891cea370552b99bb44b31e23a (diff) | |
download | luarocks-998fe0b16920f5c8316dadf7d247588a23c36b29.tar.gz luarocks-998fe0b16920f5c8316dadf7d247588a23c36b29.tar.bz2 luarocks-998fe0b16920f5c8316dadf7d247588a23c36b29.zip |
Mention failed action on invalid archive extension
Return `Couldn't extract archive <file>: unrecognized filename extension`
instead of `Unrecognized extension <ext>`, so that it's clear
that the file is being interpreted as an archive.
-rw-r--r-- | src/luarocks/fs/unix/tools.lua | 3 | ||||
-rw-r--r-- | src/luarocks/fs/win32/tools.lua | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index 7a67fb22..d0802725 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
@@ -192,8 +192,7 @@ function tools.unpack_archive(archive) | |||
192 | -- Ignore .lua and .c files; they don't need to be extracted. | 192 | -- Ignore .lua and .c files; they don't need to be extracted. |
193 | return true | 193 | return true |
194 | else | 194 | else |
195 | local ext = archive:match(".*(%..*)") | 195 | return false, "Couldn't extract archive "..archive..": unrecognized filename extension" |
196 | return false, "Unrecognized filename extension "..(ext or "") | ||
197 | end | 196 | end |
198 | if not ok then | 197 | if not ok then |
199 | return false, "Failed extracting "..archive | 198 | return false, "Failed extracting "..archive |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 1d47fa59..4adc78d1 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
@@ -204,8 +204,7 @@ function tools.unpack_archive(archive) | |||
204 | -- Ignore .lua and .c files; they don't need to be extracted. | 204 | -- Ignore .lua and .c files; they don't need to be extracted. |
205 | return true | 205 | return true |
206 | else | 206 | else |
207 | local ext = archive:match(".*(%..*)") | 207 | return false, "Couldn't extract archive "..archive..": unrecognized filename extension" |
208 | return false, "Unrecognized filename extension "..(ext or "") | ||
209 | end | 208 | end |
210 | if not ok then | 209 | if not ok then |
211 | return false, "Failed extracting "..archive | 210 | return false, "Failed extracting "..archive |