diff --git a/src/policies/size-limit-policy.ts b/src/policies/size-limit-policy.ts index 182f4b3..21c6b32 100644 --- a/src/policies/size-limit-policy.ts +++ b/src/policies/size-limit-policy.ts @@ -28,15 +28,11 @@ const sizeLimitPolicy: Policy = ({ event: { id, content, kind // Convert the content into bytes and check its size const contentSize = new TextEncoder().encode(content).length; - if (contentSize > maxContentSize && !excludeKinds.includes(kind)) { - const timestamp = new Date().toISOString(); - const logMessage = `${timestamp}: ID: ${id}, Kind: ${kind} rejected, ${contentSize} > max content size (${maxContentSize})\n`; - Deno.writeTextFileSync('./size-limit-policy.log', logMessage, { append: true }); + if (contentSize > maxContentSize && !excludeKinds.includes(kind) && kind < 10000) { return { id, action: 'reject', msg: `blocked: message is too large.`, - //msg: `blocked: ${timestamp}: ID: ${id}, Kind: ${kind} rejected, ${contentSize} > max content size (${maxContentSize})\n`, }; }