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

Commit 7bef69e

Browse files
committed
Handle more edge cases in ACL updates
1 parent af1ec76 commit 7bef69e

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
@@ -219,12 +219,16 @@ export class RoomPermalinkCreator {
219219
const getRegex = (hostname: string): RegExp =>
220220
new RegExp("^" + utils.globToRegexp(hostname, false) + "$");
221221

222-
const denied = aclEvent.getContent<{ deny: string[] }>().deny || [];
223-
denied.forEach((h) => bannedHostsRegexps.push(getRegex(h)));
222+
const denied = aclEvent.getContent<{ deny: string[] }>().deny;
223+
if (Array.isArray(denied)) {
224+
denied.forEach((h) => bannedHostsRegexps.push(getRegex(h)));
225+
}
224226

225-
const allowed = aclEvent.getContent<{ allow: string[] }>().allow || [];
227+
const allowed = aclEvent.getContent<{ allow: string[] }>().allow;
226228
allowedHostsRegexps = []; // we don't want to use the default rule here
227-
allowed.forEach((h) => allowedHostsRegexps.push(getRegex(h)));
229+
if (Array.isArray(denied)) {
230+
allowed.forEach((h) => allowedHostsRegexps.push(getRegex(h)));
231+
}
228232
}
229233
}
230234
this.bannedHostsRegexps = bannedHostsRegexps;

0 commit comments

Comments
 (0)