RGJ
(Richard - Communiteq)
12.Декабрь.2025 15:54:28
1
Отключить «приоритет имени пользователя в UX»
Включить «отображение имени в публикациях»
Создать пользователя с кавычками в имени
Попробовать процитировать его
Использование одинарных кавычек в Markdown решает эту конкретную проблему, но, разумеется, вызовет проблемы с именами, содержащими одинарную кавычку, что, вероятно, встречается чаще.
Есть ли безопасный способ экранирования кавычек в Markdown?
2 лайка
Боюсь, что нет
Самый простой и безопасный вариант — просто удалить их. Это не идеально, но, наверное, лучше, чем сломанное?
main ← strip-quotation-marks-from-names-in-quote-bbcode
merged 08:46AM - 18 Dec 25 UTC
When "display name on posts" is enabled and "prioritize username in UX" is disab… led, quoting a user with quotation marks in their display name (e.g., `John "The Dev" Smith`) breaks the quote markdown:
[quote="John "The Dev" Smith, post:1, topic:2"]
The BBCode parser's regex `"([^"]+)"` stops at the first `"` inside the name, capturing only `John ` instead of the full name.
Alternatives considered:
- Backslash escaping (`\"`): Would require updating the parser regex to support escape sequences and adding unescape logic. Adds complexity and risks breaking existing quotes.
- URL encoding (`%22`): Requires decoding when rendering. Using `decodeURIComponent` on user input creates XSS risk. A safe decoder that only decodes specific characters adds complexity and attack surface for minimal benefit.
The simplest solution is to strip quotation marks from names when building the quote BBCode. This is safe (no user input decoding), simple (no parser changes), and the minor cosmetic loss in the quote attribution is an acceptable trade-off.
The `stripQuotationMarks` function is defined alongside the existing `QUOTATION_MARKS` array in bbcode-block.js to keep related logic together and avoid duplication.
Ref - https://meta.discourse.org/t/391153
2 лайка
RGJ
(Richard - Communiteq)
12.Декабрь.2025 17:54:28
5
Вау, это было быстро Спасибо!