Skip to content

Commit

Permalink
notifications: Match on realm URL .origin, not .href.
Browse files Browse the repository at this point in the history
We had a steady stream of errors in Sentry caused by differences between
the `known_urls` and `realm_uri`, where one of those had an extra `/` on
the end (or some more surprising junk, such as a `/join/` link) [1].
Since we don't support running Zulip on a non-root path [2], we can
simply compare the domain instead of the href. This is probably more of
a band-aid than a real fix (we should figure out how the strange values
get into `known_urls` and fix that), but we might as well just check the
domain, since the path doesn't matter.

Related: zulip#4309.

[1] zulip#4309 (comment)
[2] https://chat.zulip.org/#narrow/stream/3-backend/topic/support.20for.20running.20on.20non-webroot.20url.3F
  • Loading branch information
WesleyAC committed Jun 22, 2021
1 parent 6a1744c commit 63cc7fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/notification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const getAccountFromNotificationData = (

const urlMatches = [];
identities.forEach((account, i) => {
if (account.realm.href === realmUrl.href) {
if (account.realm.origin === realmUrl.origin) {
urlMatches.push(i);
}
});
Expand Down

0 comments on commit 63cc7fd

Please sign in to comment.