• 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

Optic

Well-known member
#1
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}
Code:
<div class="flowplayer">
   <video>
      <source type="video/mp4"  src="http://test.com/flowplayer/{$id}">
   </video>
</div>

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:
bbcode-1.png

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

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

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

Optic

Well-known member
#3
I see... is there any workaround for that?

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

Mike

XenForo developer
Staff member
#5
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.)