From a109a898b55d40bb2e779522645130255459c1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Harnes?= Date: Mon, 11 Mar 2024 12:09:17 +0100 Subject: [PATCH] fix: do round base64 size down to nearest integer --- lua/img-clip/paste.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/img-clip/paste.lua b/lua/img-clip/paste.lua index d66449c..a05a72a 100644 --- a/lua/img-clip/paste.lua +++ b/lua/img-clip/paste.lua @@ -182,7 +182,7 @@ M.embed_image_as_base64 = function(file_path, opts) end -- check if base64 string is too long (max_base64_size is in KB) - local base64_size_kb = (string.len(base64) * 6) / (8 * 1024) + local base64_size_kb = math.floor((string.len(base64) * 6) / (8 * 1024)) local max_size_kb = config.get_opt("max_base64_size", opts) if base64_size_kb > max_size_kb then util.warn("Base64 string is too large (" .. base64_size_kb .. " KB). Max allowed size is " .. max_size_kb .. " KB.")