plugins/mod_http_file_share.lua
changeset 11406 a3be7b3cf1e1
parent 11402 a1f26d17d70f
child 11409 ce8291e89d67
--- a/plugins/mod_http_file_share.lua	Tue Feb 23 19:52:57 2021 +0100
+++ b/plugins/mod_http_file_share.lua	Wed Feb 24 16:35:56 2021 +0100
@@ -336,6 +336,9 @@
 		return ferr or 410;
 	end
 
+	if not filetype then
+		filetype = "application/octet-stream";
+	end
 	local disposition = "attachment";
 	if safe_types:contains(filetype) or safe_types:contains(filetype:gsub("/.*", "/*")) then
 		disposition = "inline";
@@ -343,7 +346,7 @@
 
 	response.headers.last_modified = last_modified;
 	response.headers.content_length = filesize;
-	response.headers.content_type = filetype or "application/octet-stream";
+	response.headers.content_type = filetype;
 	response.headers.content_disposition = string.format("%s; filename=%q", disposition, basename);
 
 	response.headers.cache_control = "max-age=31556952, immutable";