diff --git a/web/src/postprocess_content.ts b/web/src/postprocess_content.ts index c2cafcdebf..b5c7edaf7f 100644 --- a/web/src/postprocess_content.ts +++ b/web/src/postprocess_content.ts @@ -108,7 +108,15 @@ export function postprocess_content(html: string): string { "div.message_inline_image > a > img", )) { inline_img.setAttribute("loading", "lazy"); - if (inline_img.src.startsWith("/user_uploads/thumbnail/")) { + // We can't just check whether `inline_image.src` starts with + // `/user_uploads/thumbnail`, even though that's what the + // server writes in the markup, because Firefox will have + // already prepended the origin to the source of an image. + const image_url = new URL(inline_img.src, window.location.origin); + if ( + image_url.origin === window.location.origin && + image_url.pathname.startsWith("/user_uploads/thumbnail/") + ) { let thumbnail_name = thumbnail.preferred_format.name; if (inline_img.dataset.animated === "true") { if (