1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Strip out custom bbcode from preview

Discussion in 'Resolved Bug Reports' started by Alfa1, Jul 12, 2015.

  1. Alfa1

    Alfa1 Well-Known Member

    XF strips out bbcodes from previews, but it does not strip out custom bbcodes. This becomes an issue if you have a lot of custom bbcodes at the start of a message. Tens of thousands of my threads start with a custom bbcode. So if you hove over the thread title then you see a bunch of code. This looks like there is a bug to the end user.

    This also affects previews displayed by addons like AMS & showcase.
     
    Gladius likes this.
  2. Daniel Hood

    Daniel Hood Well-Known Member

    Do you mean when previewing before posting or previewing the thread content from the thread list (the pop up when you hover the thread title)?

    Also, this almost seems like a bug.
     
  3. Alfa1

    Alfa1 Well-Known Member

    Preview when you hover over a title. Or the display of the preview text by any addon who uses this function.
     
    Last edited: Jul 12, 2015
    Daniel Hood likes this.
  4. Gladius

    Gladius Well-Known Member

    It's also a problem in RSS feeds, actually. I've just moved a forum from vB to XF where we use a custom image code with left or right alignment at the beginning of every news post and we were having the same problem there.
     
  5. Mike

    Mike XenForo Developer Staff Member

    I was going to move this to bugs, but I think your explanation may be more specific than what you're implying.

    Custom codes are stripped out of the preview like most of the other BB codes. If I have:
    Code:
    [custom=something]Hello world[/custom]
    The preview will show:
    Code:
    Hello world
    If it is showing your custom BB code, something else is happening.

    However, I think your implying something like:
    Code:
    [custom_media=youtube]oHg5SJYRHA0[/custom_media]
    Showing:
    Code:
    oHg5SJYRHA0
    Whereas the default media tag (and default img and attach tags) replace with placeholders to indicate that it's rich content content.

    So I think what you're after is an BB code option to say that the tag doesn't produce text-only readable output.

    The RSS feed renders custom BB code to HTML without issue. It sounds to me like you haven't actually defined the custom BB code you need.
     
    Marcus likes this.
  6. Gladius

    Gladius Well-Known Member

    I've done it a bit differently than previously in vB now (where this was an issue); I installed Brogan's image float left/right mod and that indeed renders in RSS. However, text doesn't wrap around images so it looks off but I don't suppose there's any way to make that look proper in RSS? If not, I'd welcome the option to not show specific tags in RSS. E.g. we've got news image thumbnails in FLOAT_LEFT/FLOAT_RIGHT and IMG. If we can't get the text to wrap around the news images, it'd probably be better to exclude the images from the feed altogether.

    (To explain, I'm in the middle of post-migration setting up everything again on a XF the way we had it on a vB big board.)
     
  7. Mike

    Mike XenForo Developer Staff Member

    It's probably best to post anything further about your issue in a new thread as I don't think it's related to what's being discussion in this suggestion. I'm actually not clear specifically where your issue is because when you say "RSS feeds", I assume you're referring to RSS feed generation which outputs HTML and thus would generate whatever HTML your tag is generating. If you want to discuss this further, I'd recommend posting a thread in the support forum, likely with screenshots or snippets to demo specifically what you're referring to.
     
    Gladius likes this.
  8. Alfa1

    Alfa1 Well-Known Member

    I have many thousands of threads that start with this bbcode:
    Code:
    [IMGR="white]https://site.com/forum/attachment.php?attachmentid=x&stc=1&d=y[/IMGR]
    This indeed shows the vb attachment url in the snippet.

    This one is a little weirder:
    Code:
    [imgl=white]http://global.fncstatic.com/static/managed/img/Entertainment/kinston%20shirts%20website%20660.jpg[/imgl][B]Title[/B]
    
    [B]The clothing company recently debuted a new line, featuring jersey-like T-[URL='http://www.foxnews.com/entertainment/2013/08/29/cloth'][COLOR=#0066cc]shirts[/COLOR][/URL] and sweatshirts.[/B]
    
     [URL='http://www.foxnews.com/entertainment/2013/08/29/'][COLOR=#0066cc]link title[/COLOR][/URL], The shirts cost $58; sweatshirts cost $98. The tagline reads: “a quote here.”
    
    Reps could not immediately be reached for comment, but according to [URL='http://www.tmz.com/2013/08/29/'][COLOR=#0066cc]TMZ[/COLOR][/URL][COLOR=#0066cc][IMG]http://global.fncstatic.com/static/v/all/img/external-link.png[/IMG][/COLOR], they are determined to take legal action.
    
    The snippet shows:
    Code:
    [img][/COLOR], they are determined to take legal action.
     
  9. Mike

    Mike XenForo Developer Staff Member

    I'll need to take a look at that second snippet to confirm. The first snippet is broken BB code in the eyes of XenForo though -- it has an unmatched " in the parameter. The BB code stripping process for the preview is mostly designed to be "quick and dirty" rather than 100% accurate, which means there are situations where it can parse differently. It may be worth us not using that method here though.
     
    Alfa1 likes this.
  10. Alfa1

    Alfa1 Well-Known Member

    Please ignore the unmatched ". That's a typo.
     
  11. Mike

    Mike XenForo Developer Staff Member

    This is fixed now, thanks. It was a bug specific to having a custom BB code that started with "img".
     
    Alfa1 likes this.
  12. Alfa1

    Alfa1 Well-Known Member

    Thanks Mike!
     
  13. Alfa1

    Alfa1 Well-Known Member

    is this fixed in beta 4?
     
  14. Chris D

    Chris D XenForo Developer Staff Member

    Yes, it was actually fixed before Beta 3 was released.

    Also in 1.4.9/10.
     
    Alfa1 likes this.
  15. Alfa1

    Alfa1 Well-Known Member

    This is indeed fixed as the IMGL bbcode ignored in the preview snippet. But instead it turns
    Code:
    [IMGR="white]https://site.com/forum/attachment.php?attachmentid=x&stc=1&d=y[/IMGR]
    into
    Code:
    [URL]https://site.com/forum/attachment.php?attachmentid=x&stc=1&d=y[/URL]
    And fully shows this in the preview snippet.
     
  16. Chris D

    Chris D XenForo Developer Staff Member

    This will be down to how the custom BB code is configured.

    In the preview snippet the custom BB code will render based on the content of this field:

    upload_2016-2-3_13-59-15.png
     
    Alfa1 likes this.
  17. Alfa1

    Alfa1 Well-Known Member

    This field is empty. How can I avoid that the preview snippet shows anything in the bbcode tag?
    Is there anything that I can add to this field to accomplish this?
     
  18. Chris D

    Chris D XenForo Developer Staff Member

    As an example, this is the kind of use case which leads us to render the BB code out as, e.g. [ATTACH], [IMG] or [MEDIA] in scenarios such as text snippets.

    You can put anything here, and it will render that. In this case, it is left empty, "the tag will effectively be ignored, leaving only the text inside it". As the text is a URL it is auto linked to a URL tag. If this was a core XF BB code we would likely render it simply as "[IMGR]".
     

Share This Page