discourse/spec
Régis Hanol 53b3d2f0dc FIX: BBCode tag parser
Wasn't quite handling the cases where a closing bracket `]` was used in the value 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.

c39a4de139/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
2024-06-18 10:47:18 +02:00
..
fabricators DEV: Allow for setting a message with SiteSetting.set_and_log (#27447) 2024-06-13 14:59:49 +10:00
fixtures DEV: Add spec for x.com onebox url matcher (#27214) 2024-05-28 09:04:20 -03:00
generator DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
helpers FIX: Include HTML content for authenticated users with crawler UA (#26757) 2024-04-25 22:41:57 +01:00
import_export DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
initializers DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
integration DEV: remove legacy CSP implementation to make strict-dynamic only accepted behaviour (#27486) 2024-06-18 16:40:53 +08:00
integrity Enable Embroider/Webpack code spliting for Wizard (#24919) 2023-12-20 13:15:06 +00:00
jobs FIX: Jobs::EnsureS3UploadsExistence broken for multisite (#27401) 2024-06-10 16:26:39 +08:00
lib FIX: BBCode tag parser 2024-06-18 10:47:18 +02:00
mailers FIX: correctly compute the window for email summaries 2024-05-27 22:33:51 +02:00
migrations DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
models FIX: Bump reject_reason limit for reviewables to 2000 characters (#27507) 2024-06-18 15:49:58 +10:00
multisite DEV: Add S3 upload system specs using minio (#22975) 2023-08-23 11:18:33 +10:00
requests FIX: Bump reject_reason limit for reviewables to 2000 characters (#27507) 2024-06-18 15:49:58 +10:00
script/import_scripts DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
serializers UX: Disable plugin list settings button for some plugins (#27124) 2024-05-23 12:04:26 +10:00
services DEV: Allow fetching specific site settings and introduce a service for updating site settings (#27481) 2024-06-14 13:07:27 +03:00
support DEV: Fix missing require in spec/support/fake_s3 (#27399) 2024-06-10 14:02:48 +08:00
system DEV: remove legacy CSP implementation to make strict-dynamic only accepted behaviour (#27486) 2024-06-18 16:40:53 +08:00
tasks DEV: Improve test coverage of themes:update rake task (#26764) 2024-04-26 10:04:15 +08:00
views FEATURE: Simplify crawler content for non-canonical post URLs (#26324) 2024-03-26 15:18:46 +00:00
rails_helper.rb DEV: Increment attempts for ce91767b90 (#27413) 2024-06-11 16:05:38 +08:00
regenerate_swagger_docs DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
swagger_helper.rb DEV: Bump rswag-specs from 2.11.0 to 2.13.0 (#24654) 2023-12-07 08:16:47 +08:00