Skip to content

Commit

Permalink
Preserve hostname when escaping invite links (serenity-rs#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenhl committed Jul 24, 2020
1 parent 638780e commit 7dd01eb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/message_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,8 @@ fn normalize(text: &str) -> String {
.replace("discord.me", "discord\u{2024}me")
.replace("discordlist.net", "discordlist\u{2024}net")
.replace("discordservers.com", "discordservers\u{2024}com")
.replace("discord.com/invite", "discordapp\u{2024}com/invite")
.replace("discord.com/invite", "discord\u{2024}com/invite")
.replace("discordapp.com/invite", "discordapp\u{2024}com/invite")
// Remove right-to-left override and other similar annoying symbols
.replace('\u{202E}', " ") // RTL Override
.replace('\u{200F}', " ") // RTL Mark
Expand Down Expand Up @@ -1584,7 +1585,7 @@ mod test {
assert_eq!(super::normalize("discord.me"), "discord\u{2024}me");
assert_eq!(super::normalize("discordlist.net"), "discordlist\u{2024}net");
assert_eq!(super::normalize("discordservers.com"), "discordservers\u{2024}com");
assert_eq!(super::normalize("discord.com/invite"), "discordapp\u{2024}com/invite");
assert_eq!(super::normalize("discord.com/invite"), "discord\u{2024}com/invite");
assert_eq!(super::normalize("\u{202E}"), " ");
assert_eq!(super::normalize("\u{200F}"), " ");
assert_eq!(super::normalize("\u{202B}"), " ");
Expand Down

0 comments on commit 7dd01eb

Please sign in to comment.