ModifyFileDumpEvent

New in version 11.4.

The ModifyFileDumpEvent is fired in the FileDumpController and allows extensions to perform additional access / security checks before dumping a file. The event does not only contain the file to dump but also the PSR-7 Request.

In case the file dump should be rejected, the event has to set a PSR-7 response, usually with a 403 status code. This will then immediately stop the propagation.

With the event, it’s not only possible to reject the file dump request, but also to replace the file, which should be dumped.

Registration of the event in the Services.yaml:

MyVendor\MyPackage\Resource\MyEventListener:
  tags:
    - name: event.listener
      identifier: 'my-package/resource/my-event-listener'

The corresponding event listener class:

use TYPO3\CMS\Core\Resource\Event\ModifyFileDumpEvent;

class MyEventListener {

    public function __invoke(ModifyFileDumpEvent $event): void
    {
        // do magic here
    }

}

API

Implements StoppableEventInterface: As soon as a custom response is added, propagation is stopped.

getFile()

| ReturnType: \TYPO3\CMS\Core\Resource\ResourceInterface |

 

setFile(ResourceInterface $file)

| Arguments: \TYPO3\CMS\Core\Resource\ResourceInterface $file | ReturnType: void |

 

getRequest()

| ReturnType: \Psr\Http\Message\ServerRequestInterface |

 

setResponse(ResponseInterface $response)

| Arguments: \Psr\Http\Message\ResponseInterface $response | ReturnType: void |

 

getResponse()

| ReturnType: ?\Psr\Http\Message\ResponseInterface |