Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
\Input::uri() is stripping extensions from the request
  • Hello. I'm trying to pass an email address in on my GET line and am having some issues where the TLD is getting stripped e.g., '.com' in joe@blow.test.com so it gets passed to me in my controller as 'joe@blow.test'. I've tracked it down to 'input.php' lines 179-185: // Strip the defined url suffix from the uri if needed
    $uri_info = pathinfo($uri);
    if ( ! empty($uri_info))
    {
    static::$detected_ext = $uri_info;
    $uri = $uri_info.'/'.$uri_info;
    } The problem is that I'm not sure why this is being done and it doesn't look like there's any way to tell the input class to preserve the extension. I'm using fuel v1.2.1. I'm trying to build a REST controller that supports something like: GET http://mysite.com/users/john@doe.com
    -> returns user info Thanks.
    -Rick
  • Cool, this will work. I'm routing to this controller using a regex so I can safely assume in my case that I need to add the extension back. Thanks!
  • FuelPHP is a segment driven framework, which means URL extensions don't have any meaning. I understand that in this particular case it's an issue, but I haven't found a fool-proof way to detect when it is an extension, and when part of URI data. If you always expect something to be present (like in this case), you can as a workaround use Input::extension() to get the stripped extension.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion