Just wanted to report that the source filename does not get truncated, but the database field is only 255 varchar.
There should be a substring.
I personally would filter the filename by regex so that only a-zA-z0-9 can pass (of course, we need to check that the filename is not empty afterwards and set a dummy).
Greetings :)