Software /
code /
prosody
Diff
plugins/mod_http_files.lua @ 5252:6209b9a0244b
mod_http_files: No use in closing a file handle if we couldn't open it
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 21 Dec 2012 08:10:07 +0100 |
parent | 5248:13553f4132a8 |
child | 5253:ad45612199e0 |
line wrap: on
line diff
--- a/plugins/mod_http_files.lua Sun Dec 16 14:36:24 2012 +0100 +++ b/plugins/mod_http_files.lua Fri Dec 21 08:10:07 2012 +0100 @@ -106,9 +106,11 @@ end else - local f = open(full_path, "rb"); - data = f and f:read("*a"); - f:close(); + local f, err = open(full_path, "rb"); + if f then + data = f:read("*a"); + f:close(); + end if not data then return 403; end