Resolve bug in images whitelist #201

This commit is contained in:
the-djmaze 2023-02-03 08:39:09 +01:00
parent 05f45d36d1
commit 11c5b0e8f1

View file

@ -292,10 +292,12 @@ export class MessageModel extends AbstractModel {
} }
if ('match' === SettingsUserStore.viewImages()) { if ('match' === SettingsUserStore.viewImages()) {
let regex = SettingsUserStore.viewImagesWhitelist() let regex = SettingsUserStore.viewImagesWhitelist()
.trim()
.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&') .replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')
.replace(/[\s\S,;:]+/g, '|') .replace(/[\s\r\n,;:]+/g, '|')
.replace(/\|+/g, '|'); .replace(/\|+/g, '|');
if (regex.length) { if (regex.length) {
console.log('whitelist images = '+regex);
regex = new RegExp(regex); regex = new RegExp(regex);
this.showExternalImages( this.showExternalImages(
(this.from[0]?.email.match(regex)/* || this.sender[0]?.email.match(regex)*/) ? null : regex (this.from[0]?.email.match(regex)/* || this.sender[0]?.email.match(regex)*/) ? null : regex