Add type check to nativefs.getInfo()

Checks that argument #1 (path) is of type 'string'.
This commit is contained in:
rabbitboots
2022-02-28 13:06:52 -04:00
committed by GitHub
parent 18805353c2
commit d78b4f3246

View File

@@ -392,6 +392,9 @@ local function leaf(p)
end end
function nativefs.getInfo(path, filtertype) 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 dir = path:match("(.*[\\/]).*$") or './'
local file = leaf(path) local file = leaf(path)
local result, err = withTempMount(dir, getInfo, file, filtertype) local result, err = withTempMount(dir, getInfo, file, filtertype)