core icon indicating copy to clipboard operation
core copied to clipboard

Uri::current(), Uri::main() drop trailing slash

Open bproctor opened this issue 15 years ago • 8 comments

Uri::current() and Uri::main() (I'm not sure what the difference between these functions are) both drop the trailing slash from the URL.

calling: Uri::current() or Uri::main() from

http://example.com/controller/method/

returns http://example.com/controller/method

bproctor avatar Aug 31 '11 02:08 bproctor

a couple of things I should have mentioned. I'm running nginx and in my config, base_url = null. I'm looking into what might be causing this...

bproctor avatar Aug 31 '11 02:08 bproctor

Uri::main() returns the requested Uri from the browser, Uri::current() returns the requested Uri fromt the current active request object - which is the same in the main request but may differ in a HMVC request as is explained in the docs.

The returned Uri is based on what PHP tells Fuel, if PHP says there's no trailing slash than that's all Fuel knows.

jschreuder avatar Aug 31 '11 12:08 jschreuder

echo Uri::main(); echo Input::protocol() . '://' . $_SERVER['HTTP_HOST'] .'/'. $_SERVER['REQUEST_URI'];

http://example.com/subpage http://example.com/subpage/

bproctor avatar Aug 31 '11 12:08 bproctor

Should have checked, the trailing slash is trimmed by the Uri class.

jschreuder avatar Aug 31 '11 13:08 jschreuder

I'm having a hard time finding a solution to this that doesn't look like an ugly hack. Would you mind reopening this?

bproctor avatar Sep 01 '11 13:09 bproctor

You just opened #441 about this, if that's resolved (thus the trailing slash is consistantly trimmed) this isn't an issue anymore.

jschreuder avatar Sep 01 '11 13:09 jschreuder

I don't think it's the same issue

bproctor avatar Sep 01 '11 13:09 bproctor

The trailing slash should be ignored by the system, with or without should be the same Uri. We chose without as the default. Thus the dropped trailing slash isn't the issue, the issue is that it apparently matters, which you just reported in #441.

jschreuder avatar Sep 01 '11 13:09 jschreuder