Fix html export not including images (#9260)
* Fix html export not including images * Respect showPlaceholder * Add tests
This commit is contained in:
parent
638175b7d7
commit
52fc8ff255
3 changed files with 68 additions and 23 deletions
|
@ -115,6 +115,29 @@ describe('export', function() {
|
|||
});
|
||||
}
|
||||
|
||||
function mkImageEvent() {
|
||||
return new MatrixEvent({
|
||||
"content": {
|
||||
"body": "image.png",
|
||||
"info": {
|
||||
"mimetype": "image/png",
|
||||
"size": 31613,
|
||||
},
|
||||
"msgtype": "m.image",
|
||||
"url": "mxc://test.org",
|
||||
},
|
||||
"origin_server_ts": 1628872988364,
|
||||
"sender": MY_USER_ID,
|
||||
"type": "m.room.message",
|
||||
"unsigned": {
|
||||
"age": 266,
|
||||
"transaction_id": "m99999999.2",
|
||||
},
|
||||
"event_id": "$99999999999999999999",
|
||||
"room_id": mockRoom.roomId,
|
||||
});
|
||||
}
|
||||
|
||||
function mkEvents() {
|
||||
const matrixEvents = [];
|
||||
let i: number;
|
||||
|
@ -204,6 +227,18 @@ describe('export', function() {
|
|||
).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should export images if attachments are enabled", () => {
|
||||
const exporter = new HTMLExporter(mockRoom, ExportType.Beginning, {
|
||||
numberOfMessages: 5,
|
||||
maxSize: 100 * 1024 * 1024,
|
||||
attachmentsIncluded: true,
|
||||
}, null);
|
||||
const imageRegex = /<img.+ src="mxc:\/\/test.org" alt="image.png"\/>/;
|
||||
expect(imageRegex.test(
|
||||
renderToString(exporter.getEventTile(mkImageEvent(), true))),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
const invalidExportOptions: [string, IExportOptions][] = [
|
||||
['numberOfMessages exceeds max', {
|
||||
numberOfMessages: 10 ** 9,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue