Removing Spaces from Relative Paths

Permalink
Hi I am trying to validate my site and noticed Concrete does not urlencode file names before serving the relativePath

Does anyone know how I can remove these spaces, without resorting to str_replace(" ","%20",$var)

Is there a better call then getRelativePath();

or do I need to edit the function?

TheRealSean
 
Mnkras replied on at Permalink Reply
Mnkras
try using

getPath() instead
TheRealSean replied on at Permalink Reply
TheRealSean
Unfortunately this does not work either and getPath() returns the path including
/var/www/vhosts/siteulr.co.uk/httpdocs/files/imageurl.jpg

Which breaks the zoom_image block.

Using getPath() also still outputs the space.

I have got round it by using
$fileName = str_replace(" ","%20",$fo->getRelativePath());


I did attempt to alter the function getRelativePath but must be doing it in the wrong place as it will not return the corrected URL.

I'll don't know if it can be justified as a bug as it only breaks the validation at W3c the browser will still interprets it as an image and displays it.