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


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="{$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: Beats - OP.mp4


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...


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.)