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

Commit 50fdebb

Browse files
committed
Handle more edge cases in ACL updates
1 parent 8d9fdc3 commit 50fdebb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/utils/permalinks/Permalinks.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,16 @@ export class RoomPermalinkCreator {
216216
const getRegex = (hostname: string): RegExp =>
217217
new RegExp("^" + utils.globToRegexp(hostname, false) + "$");
218218

219-
const denied = aclEvent.getContent<{ deny: string[] }>().deny || [];
220-
denied.forEach((h) => bannedHostsRegexps.push(getRegex(h)));
219+
const denied = aclEvent.getContent<{ deny: string[] }>().deny;
220+
if (Array.isArray(denied)) {
221+
denied.forEach((h) => bannedHostsRegexps.push(getRegex(h)));
222+
}
221223

222-
const allowed = aclEvent.getContent<{ allow: string[] }>().allow || [];
224+
const allowed = aclEvent.getContent<{ allow: string[] }>().allow;
223225
allowedHostsRegexps = []; // we don't want to use the default rule here
224-
allowed.forEach((h) => allowedHostsRegexps.push(getRegex(h)));
226+
if (Array.isArray(denied)) {
227+
allowed.forEach((h) => allowedHostsRegexps.push(getRegex(h)));
228+
}
225229
}
226230
}
227231
this.bannedHostsRegexps = bannedHostsRegexps;

0 commit comments

Comments
 (0)