Open a bot's own files from a workspace conversation

A workspace run saves to the bot's own folder unless it picks the
workspace's, but a file chip in a workspace conversation only looked in
the workspace's folder, so those refs rendered as dead text. The chip
now sends both ids and the single-file lookup also searches the bot's
own folder for a user who reaches that bot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-27 17:41:46 +01:00
co-authored by Claude Opus 5.5
parent 211599e0fc
commit 2d3c15e48b
3 changed files with 17 additions and 4 deletions
+11 -1
View File
@@ -56,7 +56,17 @@ export const handler: BunextAPIRouteHandler<APIResponseObject<BotFileScopesPaylo
const scopes = [scope];
if (file_id) {
const file = await grabBotFile({ scopes, file_id });
/**
* A workspace run saves to the bot's own folder by default
* (`grabStorageScopes`, own first), so a chip in a workspace
* conversation looks there too, for a user who reaches that bot
* (the same reach `grabBotFileMedia` checks before the bytes).
*/
const file_scopes =
scope.scope == "workspace" && bot_id && (await grabUserBot({ bot_id, user_id: user.id }))
? [...scopes, { scope: "bot" as const, owner_id: bot_id }]
: scopes;
const file = await grabBotFile({ scopes: file_scopes, file_id });
if (!file?.id) return { success: false, msg: `Not found.` };