Skip to content

Commit

Permalink
[MM-54616] Remove regex matching for URL lookups (#2851) (#2854)
Browse files Browse the repository at this point in the history
(cherry picked from commit d2266ac)

Co-authored-by: Devin Binnie <[email protected]>
  • Loading branch information
mattermost-build and devinbinnie committed Sep 20, 2023
1 parent 4077405 commit e81b62c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/common/servers/serverManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ export class ServerManager extends EventEmitter {
return undefined;
}
const server = this.getAllServers().find((server) => {
return isInternalURL(parsedURL, server.url, ignoreScheme) && getFormattedPathName(parsedURL.pathname).match(new RegExp(`^${server.url.pathname}(.+)?(/(.+))?$`));
return isInternalURL(parsedURL, server.url, ignoreScheme) &&
getFormattedPathName(parsedURL.pathname).startsWith(server.url.pathname);
});
if (!server) {
return undefined;
Expand All @@ -135,7 +136,7 @@ export class ServerManager extends EventEmitter {
views.
filter((view) => view && view.type !== TAB_MESSAGING).
forEach((view) => {
if (getFormattedPathName(parsedURL.pathname).match(new RegExp(`^${view.url.pathname}(/(.+))?`))) {
if (getFormattedPathName(parsedURL.pathname).startsWith(view.url.pathname)) {
selectedView = view;
}
});
Expand Down

0 comments on commit e81b62c

Please sign in to comment.