Changeset

13787:3e72cdca6beb

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 23 Mar 2025 17:24:49 +0100
parents 13783:833fa5d08d13 (current diff) 13786:284b100acda1 (diff)
children 13791:aecdec3dad83
files
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http_file_share.lua	Sat Mar 22 11:56:23 2025 +0100
+++ b/plugins/mod_http_file_share.lua	Sun Mar 23 17:24:49 2025 +0100
@@ -429,18 +429,22 @@
 	local request_range = request.headers.range;
 	local response_range;
 	if request_range then
+		local last_byte = string.format("%d", tonumber(filesize) - 1);
 		local range_start, range_end = request_range:match("^bytes=(%d+)%-(%d*)$")
 		-- Only support resumption, ie ranges from somewhere in the middle until the end of the file.
-		if (range_start and range_start ~= "0") and (range_end == "" or range_end == filesize) then
+		if (range_start and range_start ~= "0") and (range_end == "" or range_end == last_byte) then
 			local pos, size = tonumber(range_start), tonumber(filesize);
 			local new_pos = pos < size and handle:seek("set", pos);
 			if new_pos and new_pos < size then
-				response_range = "bytes "..range_start.."-"..filesize.."/"..filesize;
+				response_range = "bytes "..range_start.."-"..last_byte.."/"..filesize;
 				filesize = string.format("%d", size-pos);
 			else
 				handle:close();
 				return 416;
 			end
+		else
+			handle:close();
+			return 416;
 		end
 	end
 
--- a/plugins/mod_storage_sql.lua	Sat Mar 22 11:56:23 2025 +0100
+++ b/plugins/mod_storage_sql.lua	Sun Mar 23 17:24:49 2025 +0100
@@ -885,16 +885,12 @@
 			end
 		end)
 		if indices["prosody_index"] then
-			if apply_changes then
-				local success = engine:transaction(function ()
-					return assert(engine:execute([[DROP INDEX "prosody_index";]]));
-				end);
-				if not success then
-					module:log("error", "Failed to delete obsolete index \"prosody_index\"");
-					return false;
-				end
-			else
-				changes = true;
+			local success = engine:transaction(function ()
+				return assert(engine:execute([[DROP INDEX "prosody_index";]]));
+			end);
+			if not success then
+				module:log("error", "Failed to delete obsolete index \"prosody_index\"");
+				return false;
 			end
 		end
 	end