[BBCode] Sometimes not closing an image tag errors out
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
I was editing a post, and accidentally left the closing `img` tag as open, resulting in `[img width=300]https://i.imgur.com/BGJplYw.png[img]`. This by itself does _not_ cause an error, but something else in the post's content causes it to.
This occurred on Flarum Discuss, https://discuss.flarum.org/d/20525-friendsofflarum-follow-tags/1.

Post Content (BBCode + Markdown)
~~~markdown
# Follow Tags by [FriendsOfFlarum](https://discuss.flarum.org/d/16242-friends-of-flarum-the-collaboration-for-maintained-extensions)
 [](https://packagist.org/packages/fof/follow-tags) [](https://packagist.org/packages/fof/follow-tags) [](https://opencollective.com/fof/donate) [](https://patreon.com/datitisev)
Follow tags and be notified of new discussions and replies.
[img width=300]https://i.imgur.com/BGJplYw.png[img]
### Installation
Use [Bazaar](https://discuss.flarum.org/d/5151-flagrow-bazaar-the-extension-marketplace) or install manually with composer:
```sh
composer require fof/follow-tags
```
### Updating
```sh
composer update fof/follow-tags
```
### Links
[url=https://opencollective.com/fof/donate][img height=25]https://opencollective.com/fof/donate/button@2x.png?color=blue[/img][/url] [[img height=25]https://c5.patreon.com/external/logo/become_a_patron_button.png[/img]](https://patreon.com/datitisev)
- [Packagist](https://packagist.org/packages/fof/follow-tags)
- [GitHub](https://github.com/FriendsOfFlarum/follow-tags)
An extension by [FriendsOfFlarum](https://github.com/FriendsOfFlarum).
~~~
Post Content (Compiled HTML)
~~~html
Follow Tags by FriendsOfFlarum
Follow tags and be notified of new discussions and replies.
An extension by FriendsOfFlarum.
~~~
```js
TypeError: m is null
parseUrl forum-fca934d2.js:87
forEach self-hosted:266
parseUrl forum-fca934d2.js:87
filter forum-fca934d2.js:85
filterChain forum-fca934d2.js:69
executeAttributeFilterChain forum-fca934d2.js:109
filterAttributes forum-fca934d2.js:103
oD76D04BF forum-fca934d2.js:69
filterTag forum-fca934d2.js:107
processStartTag forum-fca934d2.js:391
processCurrentTag forum-fca934d2.js:389
processTags forum-fca934d2.js:381
parse forum-fca934d2.js:294
preview forum-fca934d2.js:442
o CommentPost.js:107
```
`parseUrl` is found @ https://github.com/s9e/TextFormatter/blob/5c18a0de1336a66001df6d0f69953d3d335b438a/src/Parser/AttributeFilters/UrlFilter.js#L41
Contributor guide
Research direction
Start with the referenced UrlFilter.js parseUrl location in s9e/TextFormatter and trace how the malformed [img] input reaches the attribute filters; the browser stack also identifies CommentPost.js:107 as the caller. Reproduce the supplied post content and confirm that an unclosed image tag no longer causes the TypeError while valid image and URL markup still renders.
Written by the indexing model from the issue text.
Assessment
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100