Open rande opened 5 years ago
At this point (in a private method of a final class), we have already check that content is a MediaInterface (inside getProvider method https://github.com/ekino/EkinoTinyPngSonataMediaBundle/blob/72e95f0890927cca1fdf5bf6052cd5c225dfb307/src/Listener/MediaEventSubscriber.php#L121 and by type hinting in publishOptimizeMessage signature). Furthermore, only media handled by providers defined in configuration and from png/jpg type (https://github.com/ekino/EkinoTinyPngSonataMediaBundle/blob/72e95f0890927cca1fdf5bf6052cd5c225dfb307/src/Listener/MediaEventSubscriber.php#L129) will launch an event.
Do you think to an additional check?
Should you add a check on the content type before generating an event ?
https://github.com/ekino/EkinoTinyPngSonataMediaBundle/blob/f37c137d8e99868f2d317fdad54a63620382c470/src/Listener/MediaEventSubscriber.php#L166