[PR #3320] [CLOSED] Fix/bot browser avatar images #5879

Closed
opened 2026-10-23 04:04:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3320
Author: @Lamboozled
Created: 7/6/2026
Status: ❌ Closed

Base: staging ← Head: fix/bot-browser-avatar-images


📝 Commits (3)

  • 1fec495 fix(bot-browser): fix avatar image loading across all providers
  • 19921bb refactor(bot-browser): extract resolveValidatedImage helper; fix wyvern mime priority
  • 49f6171 Tighten avatar image MIME validation

📊 Changes

7 files changed (+55 additions, -48 deletions)

View changed files

📝 packages/server/src/routes/bot-browser-chartavern.routes.ts (+12 -9)
📝 packages/server/src/routes/bot-browser-datacat.routes.ts (+10 -8)
📝 packages/server/src/routes/bot-browser-janny.routes.ts (+4 -7)
📝 packages/server/src/routes/bot-browser-pygmalion.routes.ts (+7 -13)
📝 packages/server/src/routes/bot-browser-wyvern.routes.ts (+8 -4)
📝 packages/server/src/routes/bot-browser.routes.ts (+4 -7)
📝 packages/server/src/utils/security.ts (+10 -0)

📄 Description

Closes #3319

Why this change

  • Avatar thumbnails fail to load in the bot browser across JannyAI, DataCat, ChubAI, CharacterTavern, Wyvern, and Pygmalion due to several independent bugs in the server-side avatar proxy routes.

What changed

  • All providers — fetchAvatarImage guard changed from || to &&; images were being rejected whenever a CDN response omitted a Content-Type header even if the buffer was a valid image
  • Wyvern — removed allowedContentTypes from safeFetch and replaced with post-download isAllowedImageBuffer check; imagedelivery.net omits Content-Type on image responses
  • Pygmalion — raised avatar proxy cap 10MB→25MB and timeout 15s→30s for large card PNGs with embedded lore
  • DataCat — added media.datacat.run to host allowlist (CDN migrated from ella.janitorai.com); added Referer and User-Agent headers to pass hotlink checks
  • CharacterTavern — fixed wrong CDN host from cards.character-tavern.com (Cloudflare-protected, blocks server-side requests) to ct-cards.storage.character-tavern.com (BunnyCDN, open); added thumbnail query params

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Opened the bot browser on Zen, as well as Safari. All thumbnails now load for every card. All providers work correctly.

Docs and release impact

  • No docs changes needed

Summary by CodeRabbit

  • Bug Fixes
    • Improved avatar loading reliability across browser-based character pages, including updated Character Tavern card/CDN URLs.
    • Enhanced avatar proxy behavior to better handle inconsistent headers vs. image contents and correctly derive the returned image type.
    • Reduced avatar failures for slower/larger images by increasing proxy timeouts and maximum download size.
    • Added/strengthened image validation for proxied avatars, returning clearer “unsupported” responses and setting appropriate response headers (including caching where applicable).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/3320 **Author:** [@Lamboozled](https://github.com/Lamboozled) **Created:** 7/6/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `fix/bot-browser-avatar-images` --- ### 📝 Commits (3) - [`1fec495`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1fec495bd00a74c4e6bd736d31e01d91f5b52a53) fix(bot-browser): fix avatar image loading across all providers - [`19921bb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/19921bb61bb8ce8c0adca4442ae6c32a5eb5a44c) refactor(bot-browser): extract resolveValidatedImage helper; fix wyvern mime priority - [`49f6171`](https://github.com/Pasta-Devs/Marinara-Engine/commit/49f6171fb11ba33084477b9dd37afe7486ad0c51) Tighten avatar image MIME validation ### 📊 Changes **7 files changed** (+55 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/bot-browser-chartavern.routes.ts` (+12 -9) 📝 `packages/server/src/routes/bot-browser-datacat.routes.ts` (+10 -8) 📝 `packages/server/src/routes/bot-browser-janny.routes.ts` (+4 -7) 📝 `packages/server/src/routes/bot-browser-pygmalion.routes.ts` (+7 -13) 📝 `packages/server/src/routes/bot-browser-wyvern.routes.ts` (+8 -4) 📝 `packages/server/src/routes/bot-browser.routes.ts` (+4 -7) 📝 `packages/server/src/utils/security.ts` (+10 -0) </details> ### 📄 Description **Closes #3319** ## Why this change - Avatar thumbnails fail to load in the bot browser across JannyAI, DataCat, ChubAI, CharacterTavern, Wyvern, and Pygmalion due to several independent bugs in the server-side avatar proxy routes. ## What changed - All providers — fetchAvatarImage guard changed from || to &&; images were being rejected whenever a CDN response omitted a Content-Type header even if the buffer was a valid image - Wyvern — removed allowedContentTypes from safeFetch and replaced with post-download isAllowedImageBuffer check; imagedelivery.net omits Content-Type on image responses - Pygmalion — raised avatar proxy cap 10MB→25MB and timeout 15s→30s for large card PNGs with embedded lore - DataCat — added media.datacat.run to host allowlist (CDN migrated from ella.janitorai.com); added Referer and User-Agent headers to pass hotlink checks - CharacterTavern — fixed wrong CDN host from cards.character-tavern.com (Cloudflare-protected, blocks server-side requests) to ct-cards.storage.character-tavern.com (BunnyCDN, open); added thumbnail query params ## Validation - [x] pnpm check passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed CONTRIBUTING.md ### Manual verification notes - Opened the bot browser on Zen, as well as Safari. All thumbnails now load for every card. All providers work correctly. ## Docs and release impact - [x] No docs changes needed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved avatar loading reliability across browser-based character pages, including updated Character Tavern card/CDN URLs. * Enhanced avatar proxy behavior to better handle inconsistent headers vs. image contents and correctly derive the returned image type. * Reduced avatar failures for slower/larger images by increasing proxy timeouts and maximum download size. * Added/strengthened image validation for proxied avatars, returning clearer “unsupported” responses and setting appropriate response headers (including caching where applicable). <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:04:45 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5879
No description provided.