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

Fixed BB Code Media Sites incorrectly converts spaces in media IDs to + signs instead of %20

Discussion in 'Resolved Bug Reports' started by Optic, Dec 13, 2014.

  1. Optic

    Optic Well-Known Member

    I'm attempting to create a custom BB Code Media Site for self hosted videos using FlowPlayer.

    My intention is to use the filename as the media ID for {$id}
    <div class="flowplayer">
          <source type="video/mp4"  src="http://test.com/flowplayer/{$id}">

    The problem is if I include any spaces within the media ID BBCode, it incorrectly converts the spaces to + signs instead of %20, so the resulting video will never embed correctly as it's the wrong URL.

    Thinking maybe the Flowplayer embed code was at fault, I tried removing the Flowplayer code altogether and just put the URL of the video in the Embed HTML but with the same effect.

    Steps to reproduce:
    1. Create BB Code Media Site:

    2. Create a post with the new media BB code and include spaces in the media ID:

    3. The filename is incorrectly embedded with + signs instead of %20 in the message body:

    The correct URL is supposed to be:
    http://test.com/flowplayer/Angel Beats - OP.mp4
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    This is standard PHP functionality, urlencode() uses + signs and rawurlencode() uses %20, a different standard.
  3. Optic

    Optic Well-Known Member

    I see... is there any workaround for that?

    Otherwise I suppose I could remove the spaces in my filenames as a last resort...
  4. Mike

    Mike XenForo Developer Staff Member

  5. Mike

    Mike XenForo Developer Staff Member

    I've adjusted this to use rawurlencode as that should be safe for all case. (While I'm at it, I've changed the URL "prettifying" code in posts to use rawurlencode as well so + is kept. This appears to be consistent with how Chrome itself displays URLs when you hover them.)

Share This Page