Skip to content

[2.1]: Links containing [] can be mangled by SCEditor #8894

@Sesquipedalian

Description

@Sesquipedalian

Basic Information

In 2.1 (but not 3.0), SCEditor mangles links for URLs that contain square brackets.

Steps to reproduce

Consider the URL https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1]=2.1.

  1. Enter a link to that URL into a post, either (a) by typing [url]https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1]=2.1[/url] directly into the post text while in WYSIWYG mode, or (b) by using the editor's Insert Link button in either mode.
  2. Click the Preview button.
  3. Note how the link text is mangled and the link itself points to https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1], not https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1]=2.1.
  4. If in Source mode, toggle the editor into WYSIWYG mode.
  5. Toggle the editor into Source mode.
  6. Note how the link has been rendered in BBCode as follows:
    [url=https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1]=2.1]https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1]=2.1[/url]
    

Expected result

The preview link in step 3 should have unmangled text and should point to the correct URL.

The BBCode text in step 6 should look like this:

[url="https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1]=2.1"]https://custom.simplemachines.org/index.php?action=themes;major_smf_versions[2.1]=2.1[/url]

Actual result

See steps 3 and 6 in the steps to reproduce.

Version/Git revision

2.1.6

Database Engine

All

Database Version

No response

PHP Version

No response

Logs

Additional Information

The problem is that SCEditor is not wrapping the URL in quotation marks when transforming from HTML to BBCode.

Metadata

Metadata

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions