summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
authorMathMan05 <mathmanrm@gmail.com>2026-02-26 14:51:11 -0600
committerRory& <root@rory.gay>2026-03-20 16:31:32 +0100
commit2ff656ef03a69bde06475f314002f6b20ad79dce (patch)
tree04e656997980b4792b7afc7c9fb5ebcfdba7e1e1 /src/api/util
parentmaybe processing media? (diff)
downloadserver-ts-2ff656ef03a69bde06475f314002f6b20ad79dce.tar.xz
sign 'em
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/handlers/Message.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index 0a50809a3..54da86a87 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -163,8 +163,20 @@ async function processMedia(media: UnfurledMediaItem, messageId: string, batchId } const cloneRespBody = (await cloneResponse.json()) as { success: boolean; new_path: string }; + + const realAtt = Attachment.create({ + filename: attEnt.userFilename, + url: `${Config.get().cdn.endpointPublic}/${cloneRespBody.new_path}`, + proxy_url: `${Config.get().cdn.endpointPublic}/${cloneRespBody.new_path}`, + size: attEnt.size, + height: attEnt.height, + width: attEnt.width, + content_type: attEnt.contentType || attEnt.userOriginalContentType, + }); + await realAtt.save(); + //TODO maybe this needs to be a new DB object? I don't see a reason to do this rn though, though this id *should* technically be different from the id of the attachment - media.id = attEnt.id; + media.id = realAtt.id; media.proxy_url = `${Config.get().cdn.endpointPublic}/${cloneRespBody.new_path}`; if (url.protocol !== "attachment") media.url = media.proxy_url; media.height = attEnt.height;