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

[5.8] Convert percentage sign in filename fallback #28947

Merged
merged 4 commits into from
Jun 25, 2019
Merged

[5.8] Convert percentage sign in filename fallback #28947

merged 4 commits into from
Jun 25, 2019

Conversation

barryvdh
Copy link
Contributor

@barryvdh barryvdh commented Jun 25, 2019

This is a follow-up to #28551, and similar to #6097 and how it's done in the current ResponseFactory:

public function download($file, $name = null, array $headers = [], $disposition = 'attachment')
{
$response = new BinaryFileResponse($file, 200, $headers, true, $disposition);
if (! is_null($name)) {
return $response->setContentDisposition($disposition, $name, $this->fallbackName($name));
}
return $response;
}
/**
* Convert the string to ASCII characters that are equivalent to the given name.
*
* @param string $name
* @return string
*/
protected function fallbackName($name)
{
return str_replace('%', '', Str::ascii($name));
}

The fallback can't include a percentage sign, so this check is added.

@taylorotwell taylorotwell merged commit 95292af into laravel:5.8 Jun 25, 2019
@barryvdh barryvdh deleted the patch-12 branch June 25, 2019 14:11
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

Successfully merging this pull request may close these issues.

3 participants