Issue #3493921 by jeffam, a-fro: Sanitize migrated filenames using file settings
Here's a quick attempt at getting this to work. It may not be the best solution, but the only code in core that sanitizes a plain filename (without the path) is FileEventSubscriber::sanitizeFilename()
.
And so the only way to sanitize a filename according to the settings at /admin/config/media/file-system is to dispatch the FileUploadSanitizeNameEvent
event.