Skip to content

Commit

Permalink
fix: do round base64 size down to nearest integer
Browse files Browse the repository at this point in the history
  • Loading branch information
HakonHarnes committed Mar 11, 2024
1 parent 73f2ea3 commit a109a89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/img-clip/paste.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit a109a89

Please sign in to comment.