Announcement

Collapse
No announcement yet.

Bugfix: editing a post with linked image breaks the hyperlink

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bugfix: editing a post with linked image breaks the hyperlink

    To reproduce, on vBulletin Connect 5.5.5 create a new post with a hyperlinked image as source:


    Code:
    URL="https://vbulletin.com"]IMG2=JSON]{"data-align":"none","data-size":"full","src":"https:\/\/www.vbulletin.com\/magento\/skin\/frontend\/vbulletin\/default\/images\/logo.gif"}/IMG2]URL]
    (I removed the starting brackets in the bbcode above, otherwise it kept getting interpreted...)

    Then save the post, and edit it. You will see that in WYSIWYG mode, the image is not linked. When you view the source at this point, you will see that the URL bbcode is missing- only the IMG2 code remains. If you save the post, the hyperlink is lost.

    Possible solution: in core/vb/wysiwyghtmlparser.php:

    Code:
    # line 520:
    
    if (empty($img_node) AND $child_node->nodeName == 'img')
    {
        $img_node = $child_node;
    }
    
    Change this to:
    
    if (empty($img_node) AND $child_node->nodeName == 'img')
    {
        $img_node = $child_node;
        $node = $img_node;
    }
    
    # line 527:
    
    if (empty($img_node))
    
    Change this to:
    
    if (empty($img_node) || empty($node->parentNode))
    If you patch the file as described above, then refresh and try to edit the post again, you will see that both the URL and the IMG2 tags are still there.

  • #2
    Can verify the issue. I don't have a solution. I have created a bug report.

    https://tracker.vbulletin.com/vbulle...sues/VBV-19857
    Last edited by Wayne Luke; Wed 20th Nov '19, 11:20am.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API - Full / Mobile
    Vote for your favorite feature requests and the bugs you want to see fixed.

    Comment


    • #3
      As a workaround to this issue, I suggest using Image Attachments instead of linking images from third-party locations.
      Translations provided by Google.

      Wayne Luke
      The Rabid Badger - a vBulletin Cloud demonstration site.
      vBulletin 5 API - Full / Mobile
      Vote for your favorite feature requests and the bugs you want to see fixed.

      Comment


      • #4
        Great, thanks for your swift response.

        Unfortunately using the image attachments is not viable for our use case, but thanks for the suggestion. For the moment it's working with the little PHP hack in the opening post, but it would be perfect if it gets fixed in a later version so we don't have to manually patch the core files for each upgrade.

        Thank you.

        Comment

        Related Topics

        Collapse

        Working...
        X