Skip to content

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

@dant89

Description

@dant89

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions