2.1RC3 nesting URL inside quote tags broken

6
closed
LexArma
LexArma
Posted 1 year ago

2.1RC3 nesting URL inside quote tags broken #6336

Description

[quote="[url=https://www.rallit.fi/hyundain-wrc-tallille-sakot-mutta-tiimi-saanee-pitaa-kaksoisvoittonsa/]Rallit.fi[/url]"][b]Hyundain WRC-tallille sakot, mutta tiimi saanee pitää kaksoisvoittonsa[/b][/quote]

The above example works on 2.0, and displays correctly on 2.1 if previously posted - but can not be used in new posts made on 2.1.

Steps to reproduce

  1. Disable wysiwyg to make sure the editor isn't at fault, and post using pure BBC
  2. Extra quotation marks are added to the url, and this breaks the quote.

Environment (complete as necessary)

Seems to be related to SMF's bbc parser, not environment dependant.

Additional information/references

(Currently team private) topic for reference, this has been tested on my upgraded forum, and Kindred's test install. https://www.simplemachines.org/community/index.php?topic=575516

live627
live627
Created 1 year ago

wtf I didn't know that worked

On Sun, Nov 8, 2020 at 10:44 PM LexArma [email protected] wrote:

Description

[quote="[url= https://www.rallit.fi/hyundain-wrc-tallille-sakot-mutta-tiimi-saanee-pitaa-kaksoisvoittonsa/]Rallit.fi[/url]"][b]Hyundain WRC-tallille sakot, mutta tiimi saanee pitää kaksoisvoittonsa[/b][/quote]

The above example works on 2.0, and displays correctly on 2.1 if previously posted - but can not be used in new posts made on 2.1. Steps to reproduce

  1. Disable wysiwyg to make sure the editor isn't at fault, and post using pure BBC
  2. Extra quotation marks are added to the url, and this breaks the quote.

Environment (complete as necessary)

Seems to be related to SMF's bbc parser, not environment dependant. Additional information/references

(Currently team private) topic for reference, this has been tested on my upgraded forum, and Kindred's test install. https://www.simplemachines.org/community/index.php?topic=575516

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SimpleMachines/SMF2.1/issues/6336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADJNN5KIKHWMNFETSMJUKDSO56SLANCNFSM4TO34GBQ .

LexArma
LexArma
Created 1 year ago

Live and learn, eh? :P

BrickOzp
BrickOzp
Created 1 year ago

I have investigated this problem.

On 2.0.17 the message seems not to be modified: [quote="[url=https://www.rallit.fi/hyundain-wrc-tallille-sakot-mutta-tiimi-saanee-pitaa-kaksoisvoittonsa/]Rallit.fi[/url]"][b]Hyundain WRC-tallille sakot, mutta tiimi saanee pitää kaksoisvoittonsa[/b][/quote]

On 2.1rc3 the message is modified upon posting to: [quote="[url="https://www.rallit.fi/hyundain-wrc-tallille-sakot-mutta-tiimi-saanee-pitaa-kaksoisvoittonsa/"]Rallit.fi[/url]"][b]Hyundain WRC-tallille sakot, mutta tiimi saanee pitää kaksoisvoittonsa[/b][/quote]

The extra quotation marks are added by preparsecode()->FixTags()->fixTag() in Subs-Post.php. There have been alot of changes to preparsecode between 2.0.17 to 2.1rc3

If the message is modified in the db and the extra quotation marks removed, the quote is rendered correctly on 2.1rc3 as well.

The raw data in the db: [quote="[url="https://www.rallit.fi/hyundain-wrc-tallille-sakot-mutta-tiimi-saanee-pitaa-kaksoisvoittonsa"]Rallit.fi[/url]"][b]Hyundain WRC-tallille sakot, mutta tiimi saanee pitää kaksoisvoittonsa[/b][/quote]

The problem with the rendering with the extra quotation marks comes from parse_bbc() in Subs.php When the quote bbc tag is parsed and the data part should be extracted the ending quotation mark '"]' from the [url] tag is detected as the end of the [quote=""]

[url="https://www.rallit.fi/hyundain-wrc-tallille-sakot-mutta-tiimi-saanee-pitaa-kaksoisvoittonsa is then recursively sent to parse_bbc() for parsing

I don't know if this should be fixed when the data is posted or if it should be fixed during rendering.

LexArma
LexArma
Created 1 year ago

Not knowing the code behind it, I would say as long as we can keep backwards compatibility and display posts from 2.0 correctly on an updated 2.1, and allow new posts to be made with the same output, even if the input would differ - the actual structure shouldn't be an issue from the user POV. But, I would ask however - are the quotation marks actually needed in this case? If not, perhaps better to try circumvent their adding in this particular situation.

BrickOzp
BrickOzp
Created 1 year ago

I tried to add a solution for not adding the quotes during the posting but depending on how fixTag() is implemented I went with a solution during rendering time instead.

fixTag() will replace all occurrences of a detected tag. So in the unlikely event of the message containing both the quote with nested url tag and exactly the same url time once more, it was not possible to only have one of them unquoted.

This new code will display nested quotes correctly both for old (2.0.17) and new (2.1) posts.

LexArma
LexArma
Created 1 year ago

Neato. :) Tried and tested, don't see any issues with the solution. 👍