fix(attachments): default download inline limit off (use export cache)

PEARCORD_ATTACHMENT_DOWNLOAD_MAX=0 sends full files via download-cache path.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-25 00:39:35 -04:00
co-authored by Cursor
parent c54e06f390
commit 513a10359d
+6 -2
View File
@@ -1408,7 +1408,11 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
if (t === 'request-attachment-download') {
const attachmentId = msg.attachmentId
const downloadTimeoutMs = Number(process.env.PEARCORD_ATTACHMENT_DOWNLOAD_MS || 30000)
const maxInlineBytes = Number(process.env.PEARCORD_ATTACHMENT_DOWNLOAD_MAX || 512 * 1024)
const maxInlineRaw = process.env.PEARCORD_ATTACHMENT_DOWNLOAD_MAX
const maxInlineBytes =
maxInlineRaw === undefined || maxInlineRaw === '' || maxInlineRaw === '0'
? 0
: Number(maxInlineRaw)
const sendDownloadError = (message) => {
try {
send({
@@ -1428,7 +1432,7 @@ async function dispatchUiMessage (platform, msg, hooks = {}) {
})
])
if (!exported?.filePath) throw new Error('attachment file empty')
if (exported.size > maxInlineBytes) {
if (maxInlineBytes > 0 && exported.size > maxInlineBytes) {
try {
send({
type: 'attachment-download-saved',