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

Special characters on file name breaking UrlBuilder->getUrl #276

Open
luizgaroland opened this issue May 30, 2020 · 0 comments
Open

Special characters on file name breaking UrlBuilder->getUrl #276

luizgaroland opened this issue May 30, 2020 · 0 comments

Comments

@luizgaroland
Copy link

luizgaroland commented May 30, 2020

Currently im having a problem with the UrlBuilder.

UrlBuilder->getUrl uses parse_url and it return the wrong path for my files if they have a special character on the name.

For example Se#ection_188.png becomes '/path/Se' and it causes a failure.

To fix this i did something like this just before the parse_url:

$pathinfo = pathinfo($path);
$encodedFileName = urlencode($pathinfo['basename']);
$pathinfo['dirname'] = implode('/', array_map(function ($element) {
    return urlencode($element);
}, explode('/', $pathinfo['dirname'])));
$path = $pathinfo['dirname'] . '/' . $encodedFileName;

And then decoded the path inside the request controller.

Is there a way to achieve this without having to edit the the UrlBuilder directly?

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

1 participant