mirror of https://github.com/zulip/zulip.git
web: Fix usage of .replace with variable replacement.
String.prototype.replace and String.prototype.replaceAll interpret certain sequences such as $$ within a string provided as the replacement argument. Avoid this interpretation by providing a function. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
44c4b93f6e
commit
64cabae46d
|
@ -781,7 +781,7 @@ export function get_external_account_link(field) {
|
|||
} else {
|
||||
field_url_pattern = realm.realm_default_external_accounts[field_subtype].url_pattern;
|
||||
}
|
||||
return field_url_pattern.replace("%(username)s", field.value);
|
||||
return field_url_pattern.replace("%(username)s", () => field.value);
|
||||
}
|
||||
|
||||
export function set_up() {
|
||||
|
|
|
@ -1188,7 +1188,7 @@ Parser.prototype.parse = function(src) {
|
|||
if (!safe) {
|
||||
html = escape(html);
|
||||
}
|
||||
output = output.replace('<p>' + key + '</p>', html)
|
||||
output = output.replace('<p>' + key + '</p>', () => html)
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue