Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route tokens containing slashes #216

Open
xfra35 opened this issue May 17, 2017 · 1 comment
Open

Route tokens containing slashes #216

xfra35 opened this issue May 17, 2017 · 1 comment

Comments

@xfra35
Copy link
Member

xfra35 commented May 17, 2017

This is a followup of #214.

When defining a route like GET /explorer/@path: should encoded slashes be allowed inside @path or not?

E.g: /explorer/abc%2fdef.

Background:

We need to decide:

  • either we make it clear that route tokens should never contain slashes
  • or we replace the call to urldecode with something that would decode everything but slashes

Here are two suggestions for decoding UTF-8 characters while preserving encoded slashes:

// solution #1 (case sensitive)
$req=urldecode(str_replace(['%2f','%2F'],['%252f','%252F'],$this->hive['PATH']));

// solution #2 (case insensitive)
$req=implode('/',array_map(function($str){return str_replace('/','%2f',urldecode($str));},explode('/',$this->hive['PATH'])));
@xfra35 xfra35 mentioned this issue May 17, 2017
@bcosca
Copy link
Collaborator

bcosca commented May 18, 2017

Why not a configurable hive variable (like PASSTHRU) so we can maintain backward comptibility and at the same time allow the dev to make that decision to override default behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants