fix(logging): redact PII from media-error console warnings
msgContent media load/thumbnail failures now log only the error name+message, not the full error/event object that may carry content data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -50,7 +50,7 @@ export const getImageMsgContent = async (
|
|||||||
): Promise<IContent> => {
|
): Promise<IContent> => {
|
||||||
const { file, originalFile, encInfo, metadata } = item;
|
const { file, originalFile, encInfo, metadata } = item;
|
||||||
const [imgError, imgEl] = await to(loadImageElement(getImageFileUrl(originalFile)));
|
const [imgError, imgEl] = await to(loadImageElement(getImageFileUrl(originalFile)));
|
||||||
if (imgError) console.warn('Failed to load image element:', imgError.message);
|
if (imgError) console.warn('Failed to load image element:', imgError.name, imgError.message);
|
||||||
|
|
||||||
const content: IContent = {
|
const content: IContent = {
|
||||||
msgtype: MsgType.Image,
|
msgtype: MsgType.Image,
|
||||||
@@ -85,7 +85,8 @@ export const getVideoMsgContent = async (
|
|||||||
const { file, originalFile, encInfo, metadata } = item;
|
const { file, originalFile, encInfo, metadata } = item;
|
||||||
|
|
||||||
const [videoError, videoEl] = await to(loadVideoElement(getVideoFileUrl(originalFile)));
|
const [videoError, videoEl] = await to(loadVideoElement(getVideoFileUrl(originalFile)));
|
||||||
if (videoError) console.warn('Failed to load video element:', videoError.message);
|
if (videoError)
|
||||||
|
console.warn('Failed to load video element:', videoError.name, videoError.message);
|
||||||
|
|
||||||
const content: IContent = {
|
const content: IContent = {
|
||||||
msgtype: MsgType.Video,
|
msgtype: MsgType.Video,
|
||||||
@@ -109,7 +110,8 @@ export const getVideoMsgContent = async (
|
|||||||
scaleYDimension(videoEl.videoWidth, 512, videoEl.videoHeight),
|
scaleYDimension(videoEl.videoWidth, 512, videoEl.videoHeight),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (thumbError) console.warn('Failed to generate video thumbnail:', thumbError.message);
|
if (thumbError)
|
||||||
|
console.warn('Failed to generate video thumbnail:', thumbError.name, thumbError.message);
|
||||||
content.info = {
|
content.info = {
|
||||||
...getVideoInfo(videoEl, file),
|
...getVideoInfo(videoEl, file),
|
||||||
...thumbContent,
|
...thumbContent,
|
||||||
|
|||||||
Reference in New Issue
Block a user