Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
topic_link_util: Add `&` as a character which can produce broken links.
Kislay Udbhav Verma6956947a7379
diff --git a/web/src/topic_link_util.ts b/web/src/topic_link_util.tsindex f56c9146228..95bc1412cbb 100644--- a/web/src/topic_link_util.ts+++ b/web/src/topic_link_util.ts@@ -4,7 +4,7 @@ import * as internal_url from "../shared/src/internal_url";import * as stream_data from "./stream_data";-const invalid_stream_topic_regex = /[*>`]|(\$\$)/g;+const invalid_stream_topic_regex = /[`>*&]|(\$\$)/g;export function will_produce_broken_stream_topic_link(word: string): boolean {return invalid_stream_topic_regex.test(word);@@ -24,6 +24,8 @@ export function escape_invalid_stream_topic_characters(text: string): string {return ">";case "*":return "*";+ case "&":+ return "&";case "$$":return "$$";default:diff --git a/web/tests/topic_link_util.test.js b/web/tests/topic_link_util.test.jsindex 905e5db0c3d..b38910fd334 100644--- a/web/tests/topic_link_util.test.js+++ b/web/tests/topic_link_util.test.js@@ -83,6 +83,11 @@ run_test("stream_topic_link_syntax_test", () => {"[#$$MONEY$$](#narrow/channel/6-.24.24MONEY.24.24)",);+ assert.equal(+ topic_link_util.get_stream_topic_link_syntax("#**Sweden>&ab", "&ab"),+ "[#Sweden>&ab](#narrow/channel/1-Sweden/topic/.26ab)",+ );+// Only for full coverage of the module.assert.equal(topic_link_util.escape_invalid_stream_topic_characters("Sweden"), "Sweden");});