Skip to content

Commit

Permalink
fix: meta value is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr13 committed Dec 23, 2024
1 parent ed17b39 commit 953c60b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,18 @@ class Client {
// stringify meta values and limit keys and values length to 255
if (meta) {
for (const key in meta) {
if (key === undefined || key === null) continue;
if (typeof meta[key] === 'object') {
meta[key] = JSON.stringify(meta[key]);
}

// cut values
if (meta[key].length > 255) {
if (meta[key]?.length > 255) {
meta[key] = meta[key].substring(0, 255);
debug(APP_PREFIX, `Meta info value "${meta[key]}" is too long, trimmed to 255 characters`);
}

// cut keys
if (key.length > 255) {
if (key?.length > 255) {
const newKey = key.substring(0, 255);
meta[newKey] = meta[key];
delete meta[key];
Expand Down

0 comments on commit 953c60b

Please sign in to comment.