changeset 5671:c8322c64a548

mod_storage_s3: Implement keyvalue deletion
author Kim Alvefur <zash@zash.se>
date Sat, 14 Oct 2023 21:40:46 +0200
parents 2c9d72ef829e
children c74a96dc5d58
files mod_storage_s3/mod_storage_s3.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_s3/mod_storage_s3.lua	Sat Oct 14 21:40:20 2023 +0200
+++ b/mod_storage_s3/mod_storage_s3.lua	Sat Oct 14 21:40:46 2023 +0200
@@ -142,7 +142,12 @@
 end
 
 function keyval:set(user, data)
-	return async.wait_for(new_request("PUT", self:_path(user), data));
+
+	if data == nil or (type(data) == "table" and next(data) == nil) then
+		return async.wait_for(new_request("DELETE", self:_path(user)));
+	end
+
+	return async.wait_for(new_request("PUT", self:_path(user), nil, data));
 end
 
 function keyval:users()