2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FIX: strip zero width spaces from topic title

This commit is contained in:
Arpit Jalan 2018-02-20 23:52:36 +05:30
parent 677e126fbf
commit a4bc54a686
2 changed files with 9 additions and 1 deletions

View file

@ -17,7 +17,8 @@ class TextCleaner
remove_all_periods_from_the_end: SiteSetting.title_prettify,
remove_extraneous_space: SiteSetting.title_prettify && SiteSetting.default_locale == "en",
fixes_interior_spaces: true,
strip_whitespaces: true
strip_whitespaces: true,
strip_zero_width_spaces: true
}
end
@ -47,6 +48,8 @@ class TextCleaner
text = normalize_whitespaces(text)
# Strip whitespaces
text.strip! if opts[:strip_whitespaces]
# Strip zero width spaces
text.gsub!(/\u200b/, '') if opts[:strip_zero_width_spaces]
text
end