Skip to content

Commit 35719d5

Browse files
committed
Fix | Non-Production Local Filesystem Storage for Alters Bug
1 parent dac7ed8 commit 35719d5

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tomoribot",
3-
"version": "0.7.911",
3+
"version": "0.7.912",
44
"description": "Customizable AI Assistant Discord Bot",
55
"main": "./src/index.ts",
66
"type": "module",

src/utils/storage/avatarStorage.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ export async function uploadPersonaAvatarToS3(options: AvatarUploadOptions): Pro
246246
}
247247
}
248248

249-
// Non-production: store locally and return base64 data URI for Discord embeds
249+
// Non-production: store under data/avatars/ and return the normalized local path.
250+
// Callers store this path in webhook_avatar_url; downstream code resolves it to
251+
// a public URL (if AVATAR_PUBLIC_BASE_URL is set) or loads the buffer directly
252+
// to mutate the shared webhook avatar before each send.
250253
const storedPath = buildLocalStoredPath(options);
251254
const absolutePath = resolveLocalAvatarPath(storedPath);
252255
if (!absolutePath) {
@@ -256,12 +259,8 @@ export async function uploadPersonaAvatarToS3(options: AvatarUploadOptions): Pro
256259
try {
257260
await fs.mkdir(path.dirname(absolutePath), { recursive: true });
258261
await fs.writeFile(absolutePath, options.buffer);
259-
260-
// Return as base64 data URI so Discord embeds can display it persistently
261-
// Unlike attachment:// URLs, data URIs work anywhere and don't expire
262-
const base64DataUri = `data:image/png;base64,${options.buffer.toString("base64")}`;
263-
log.success(`[Avatar Storage] Stored persona avatar${label} locally (non-production)`);
264-
return base64DataUri;
262+
log.success(`[Avatar Storage] Stored persona avatar${label} at ${storedPath}`);
263+
return normalizeStoredPath(storedPath);
265264
} catch (error) {
266265
log.warn(`[Avatar Storage] Failed to store persona avatar${label} locally`, error);
267266
return null;

0 commit comments

Comments
 (0)