router icon indicating copy to clipboard operation
router copied to clipboard

unable to capture trailing %2F in url

Open divinity76 opened this issue 4 years ago • 2 comments

lets say you have

$router->get("/([\s\S]+)",function(){
    var_dump(func_get_args());
});

the router will not differentiate between the url /foo and foo%2F and foo%2f%2f, any/all trailing %2F's will be trimmed away by the router before going to the callback function

divinity76 avatar Feb 07 '21 18:02 divinity76

This is by design.

Now that you bring this to my attention, it is not explicitly mentioned in the docs, which should be the case.

bramus avatar Feb 08 '21 10:02 bramus

@bramus removing trailing / makes sense, but i'm not convinced that removing trailing %2F is a good idea.. %2F is explicitly an escaped / that is supposed to be part of the url data, not part of the url itself =/

but it's a documentation issue then? good to know;

(fwiw i made a bramus/router-inspired router here which doesn't remove %2F for a project where i needed to preserve %2F )

divinity76 avatar Feb 08 '21 12:02 divinity76