modules/base: ltn12: source.file() should terminate when an empty chunk is read
[project/luci.git] / modules / base / luasrc / ltn12.lua
index 9371290..b59fb8c 100644 (file)
@@ -144,6 +144,7 @@ function source.file(handle, io_err)
     if handle then
         return function()
             local chunk = handle:read(BLOCKSIZE)
+            if chunk and chunk:len() == 0 then chunk = nil end
             if not chunk then handle:close() end
             return chunk
         end