Issue Bug Closed

#99534Content-Type forced to text/html when streaming file

Gregor Hermens 01/13/23, 13:00 updated 03/05/24, 17:10

Description

I have an extbase action that streams a file like

/** @var \TYPO3\CMS\Core\Resource\FileReference $file */
$originalFile = $file->getOriginalResource()->getOriginalFile();
return $originalFile->getStorage()->streamFile(
  $originalFile,
  false
);

The target page is stripped down to the minimum:

config >
config {
    disableAllHeaderCode = 1
    disableBodyTag = 1
    disableCharsetHeader = 1
    disableLanguageHeader = 1
    doctype = none
    admPanel = 0
    debug = 0
    xhtml_cleaning = none
    disablePrefixComment = 1
    no_cache = 1
}

page >
page = PAGE
page {
    10 = COA_INT
    10 {
        10 < tt_content.list.20.myext_downloadstream
    }
}

This has worked up to TYPO3 11.5.21.
With TYPO3 11.5.22 the Content-Type header is forced to text/html.

I suspect #99373 to cause this, but can’t find the exact reason.
The correct Content-Type is set if I comment line 185 of
TYPO3\CMS\Extbase\Core\Bootstrap->handleFrontendRequest(): $response = $response->withoutHeader(‘Content-Type’);

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.