XF 2.2 Slashes in route builder?

Jaxel

Well-known member
I have the following code:
Code:
            return $this->redirect($this->buildLink('ewr-rio', [
                'service_id' => '2',
                'stream_value1' => 'UCIW3tvBA80HhhuMwlR9imlA',
                'stream_value2' => '/c/8wayrun/',
            ]));

The route builder is as follows:
Code:
:int<service_id>/:str<stream_value1>/:str<stream_value2>/:page

This works fine, in most cases. However, stream_value2 contains slashes in it.
Isn't the route builder supposed to sanitize the strings so that it doesn't screw with the URL?

It should try to take me to:
Code:
streams/2/UCIW3tvBA80HhhuMwlR9imlA/c8wayrun/
Instead it takes me to:
Code:
streams/2/UCIW3tvBA80HhhuMwlR9imlA//c/8wayrun/

Is this a bug?
 
The router doesn't really do anything with passed string parameters because presumably they're going to be used for look ups, and processing the string could create ambiguities in how to resolve them back to their original form. It may be best to add a getter or column on your entity that would give you a string suitable for use as a route parameter.
 
Back
Top Bottom