Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix wrong assertions that all media events have a mimetype (#8946)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Jun 30, 2022
1 parent 7a80ea4 commit bb859d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/views/messages/MImageBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
if (content.info?.w && content.info?.h) {
infoWidth = content.info.w;
infoHeight = content.info.h;
infoSvg = content.info.mimetype.startsWith("image/svg");
infoSvg = content.info.mimetype === "image/svg+xml";
} else {
// Whilst the image loads, display nothing. We also don't display a blurhash image
// because we don't really know what size of image we'll end up with.
Expand Down
4 changes: 2 additions & 2 deletions src/utils/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { arrayHasDiff } from "./arrays";

export function mayBeAnimated(mimeType: string): boolean {
export function mayBeAnimated(mimeType?: string): boolean {
// AVIF animation support at the time of writing is only available in Chrome hence not having `blobIsAnimated` check
return ["image/gif", "image/webp", "image/png", "image/apng", "image/avif"].includes(mimeType);
}
Expand All @@ -34,7 +34,7 @@ function arrayBufferReadStr(arr: ArrayBuffer, start: number, len: number): strin
return String.fromCharCode.apply(null, arrayBufferRead(arr, start, len));
}

export async function blobIsAnimated(mimeType: string, blob: Blob): Promise<boolean> {
export async function blobIsAnimated(mimeType: string | undefined, blob: Blob): Promise<boolean> {
switch (mimeType) {
case "image/webp": {
// Only extended file format WEBP images support animation, so grab the expected data range and verify header.
Expand Down

0 comments on commit bb859d5

Please sign in to comment.