Skip to content

Commit

Permalink
路径是一个文件夹,read(a) content是nil
Browse files Browse the repository at this point in the history
  • Loading branch information
huahua132 committed Aug 1, 2023
1 parent 13f56ae commit 26f16e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
*.dSYM
.DS_Store
/lualib/rax.lua
.vscode
8 changes: 6 additions & 2 deletions lualib/util/file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ local function read_filecache(_, filepath)
if f then
local content = f:read "a"
f:close()
local mimetype = via_content(content, filepath)
filecache[filepath] = { content, mimetype }
if content then
local mimetype = via_content(content, filepath)
filecache[filepath] = { content, mimetype }
else
filecache[filepath] = {}
end
else
filecache[filepath] = {}
end
Expand Down
1 change: 0 additions & 1 deletion lualib/wlua/request.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function M:new(id, interface)
body_raw = body_raw,
url = url,
origin_uri = url,
uri = url,
headers = headers, -- request headers
code = code,

Expand Down

0 comments on commit 26f16e5

Please sign in to comment.