LibreChat/api/server/services/Files/images
Hao bd08a363c4
🔣 fix: Encode Images From Storage Keys (#15851)
* fix: Prefer storage keys for image encoding

* fix: Sanitize assistant image errors

* fix: Sanitize agent image storage errors

* fix: Move blob image encoding into API package

* fix: Complete image encoder TypeScript migration

* fix: Keep request-boundary error logs diagnosable

getSafeErrorMetadata reduces an error to { type: 'Error' } and an optional
status. That is the right bound where an error may echo submitted content, and
it stays in place at getS3FileStream, getAzureFileStream and
getFirebaseFileStream, where a signed URL reaches the log.

Applied at ResumableAgentController's initialization catch and the chatV1
generic branch it blinded the whole route: a missing key, an agent that fails to
load and a database error all logged as { type: 'Error' }, with no message,
name, code or stack.

getSafeErrorText keeps the error's own description and stack, reduces every URL
to its origin so an object path and signature cannot ride along, and strips
bearer credentials. It returns text so the two handlers log it inside the
message and pass no winston metadata, which is what stops an SDK error's own
enumerable properties (request.url, config, response.headers) from being
promoted onto the record.

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
2026-09-12 12:39:26 -04:00
..
avatar.js 🪪 fix: Use Shared IdP Avatar Processing (#13422) 2026-05-30 16:51:58 -07:00
avatar.spec.js 🪪 fix: Use Shared IdP Avatar Processing (#13422) 2026-05-30 16:51:58 -07:00
convert.js 🌥️ feat: Add Optional Region-aware S3/CloudFront Storage Keys (#12987) 2026-05-06 23:16:56 -04:00
encode.js 🔣 fix: Encode Images From Storage Keys (#15851) 2026-09-12 12:39:26 -04:00
encode.spec.js 🔣 fix: Encode Images From Storage Keys (#15851) 2026-09-12 12:39:26 -04:00
index.js 🛜 refactor: Streamline App Config Usage (#9234) 2025-08-26 12:10:18 -04:00
resize.js 🏷️ fix: Record the Media Type of Saved Images, Not the Declared One (#15606) 2026-09-04 11:51:28 -04:00