Firepup650
(Firepup Sixfifty)
17 مايو 2024، 3:09م
1
أمثلة، مع بيانات قناة وهمية:
[chat quote=“شخص عشوائي؛0؛0000-01-01T00:00:00Z” channel=“قناة رائعة”]
هذا الاقتباس يعمل بشكل جيد
[/chat]
[chat quote=“شخص عشوائي؛0؛0000-01-01T00:00:00Z” channel=“[قناة رائعة]”]
هذا الاقتباس لا يعمل بشكل جيد
[/chat]
إعجابَين (2)
شكراً على التقرير @Firepup650
أعتقد أنه كان الوقت المناسب لنا أخيراً
closed = true;
break;
}
}
if (closed) {
length = i - start + 1;
let raw = src.slice(start + tag.length + 1, i);
// trivial parser that is going to have to be rewritten at some point
if (raw) {
let match, key, val;
while ((match = ATTR_REGEX.exec(raw))) {
if (match[1]) {
key = "_default";
} else {
key = match[4];
}
سيتم إصلاح هذا بمجرد مراجعة هذا الطلب ودمجه
main ← fix-bbcode-parser
opened 08:48AM - 24 May 24 UTC
Wasn't quite handling the cases where a closing bracket `]` was used in the valu… e of one of the attributes.
```markdown
[chat quote=user channel="[broken]"]
```
Would not be correctly parsed because we would _greedily_ use the first `]` as the end of the tag even though it might be a valid character when inside proper quotes.
https://github.com/discourse/discourse/blob/c39a4de139ed9bba4696d44b15cb7569038b5fde/app/assets/javascripts/discourse-markdown-it/src/features/bbcode-block.js#L62
Re-wrote the `parseBBCodeTag` to properly handle the following cases
- A closing tag (aka `[/name]`) which are easy since they don't have any attributes
- An old `[quote=...]` format we used that doesn't uses quotes but still has various attributes of the form `key:value`
- All three valid BBCode opening tag formats we support
- `[name]` without any attributes
- `[name=foo]` with a default value
- `[name foo=bar]` with some attributes
Ended up having to fix/rewrite the few bbcode rules that were using the `parseBBCodeTag` function, namely `d-wrap` and `discourse-local-dates`.
While working on this, I think I also found a way to get rid the of shims we had in place so that plugins could use the `parseBBCodeTag` function.
Reference - https://meta.discourse.org/t/having-a-right-bracket-in-a-channel-name-breaks-all-quotes-from-that-channel/308439
إعجاب واحد (1)
واجهت هذه المشكلة/الحل بعد العثور على خطأ متعلق بتحميل الملفات. إذا كان اسم الملف يحتوي على الحرف ‘]’ بدون ‘[’ مسبق، فإنه يكسر التنسيق ولا ينشئ الرابط. أشك في أن إصلاح محلل BBCode هنا سيعالج هذه المشكلة أيضًا، لكنني أذكرها في حال تم تحليلها في مكان آخر.
تم دمج طلب السحب (PR)، ونشره هنا، وإعادة خبز OP
3 إعجابات
تم إغلاق هذا الموضوع تلقائيًا بعد 3 أيام. لم تعد الردود الجديدة مسموح بها.