From d78b4f3246db406d5b2c786a8cb7b95aaa7803b9 Mon Sep 17 00:00:00 2001 From: rabbitboots Date: Mon, 28 Feb 2022 13:06:52 -0400 Subject: [PATCH] Add type check to nativefs.getInfo() Checks that argument #1 (path) is of type 'string'. --- nativefs.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nativefs.lua b/nativefs.lua index 053df73..16e7ca9 100644 --- a/nativefs.lua +++ b/nativefs.lua @@ -392,6 +392,9 @@ local function leaf(p) end function nativefs.getInfo(path, filtertype) + if type(path) ~= 'string' then + error("bad argument #1 to 'getInfo' (string expected, got " .. type(path) .. ")") + end local dir = path:match("(.*[\\/]).*$") or './' local file = leaf(path) local result, err = withTempMount(dir, getInfo, file, filtertype)