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

HTML append breaks BinaryFileResponse due to default null content type #37

Open
dant89 opened this issue Apr 30, 2020 · 0 comments
Open

Comments

@dant89
Copy link

dant89 commented Apr 30, 2020

The Symfony\Component\HttpFoundation\BinaryFileResponse(); on default instantiation has a null content type, this bundle intercepts those files and tries to inject the tag manager into the file, correctly Symfony does not allow this and throws a 500 error:

Uncaught PHP Exception LogicException: "The content cannot be set on a BinaryFileResponse instance."

Maybe the logic here could be reviewed to not try to inject when the content type is null?

// only append to HTML responses
if (!in_array($event->getResponse()->headers->get('content-type'), array('text/html', null))) {
    return false;
}
@dant89 dant89 changed the title BinaryFileResponse broken due to default null content type HTML append breaks BinaryFileResponse due to default null content type Apr 30, 2020
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