mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 03:05:51 +03:00
Treat thumbnail upload failures as complete upload failures (#10829)
Without this it'll be treated the same as a thumbnailing failure which falls back to m.file
This commit is contained in:
parent
9b6973d71a
commit
5d0b5131f2
1 changed files with 13 additions and 2 deletions
|
@ -22,7 +22,14 @@ import encrypt from "matrix-encrypt-attachment";
|
|||
import extractPngChunks from "png-chunks-extract";
|
||||
import { IImageInfo } from "matrix-js-sdk/src/@types/partials";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { IEventRelation, ISendEventResponse, MatrixEvent, UploadOpts, UploadProgress } from "matrix-js-sdk/src/matrix";
|
||||
import {
|
||||
HTTPError,
|
||||
IEventRelation,
|
||||
ISendEventResponse,
|
||||
MatrixEvent,
|
||||
UploadOpts,
|
||||
UploadProgress,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { THREAD_RELATION_TYPE } from "matrix-js-sdk/src/models/thread";
|
||||
import { removeElement } from "matrix-js-sdk/src/utils";
|
||||
|
||||
|
@ -526,7 +533,11 @@ export default class ContentMessages {
|
|||
const imageInfo = await infoForImageFile(matrixClient, roomId, file);
|
||||
Object.assign(content.info, imageInfo);
|
||||
} catch (e) {
|
||||
// Failed to thumbnail, fall back to uploading an m.file
|
||||
if (e instanceof HTTPError) {
|
||||
// re-throw to main upload error handler
|
||||
throw e;
|
||||
}
|
||||
// Otherwise we failed to thumbnail, fall back to uploading an m.file
|
||||
logger.error(e);
|
||||
content.msgtype = MsgType.File;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue