Bugfix: whitelist fails when empty or when using : #938

This commit is contained in:
the-djmaze 2023-02-09 16:16:50 +01:00
parent 6c14055006
commit b2079f7263

View file

@ -402,19 +402,19 @@ export class MessageModel extends AbstractModel {
regex = SettingsUserStore.viewImagesWhitelist()
.trim()
.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')
.replace(/[\s\r\n,;:]+/g, '|')
.replace(/[\s\r\n,;]+/g, '|')
.replace(/\|+/g, '|');
if (regex) {
console.log('whitelist images = '+regex);
regex = new RegExp(regex);
if (this.from[0]?.email.match(regex)) {
regex = 0;
regex = null;
}
}
}
let hasImages = false,
isValid = src => {
if (!regex || src.match(regex)) {
if (null == regex || (regex && src.match(regex))) {
return true;
}
hasImages = true;