What do you mean by "extension"? This patch truncate sequence of chars after last dot longer then 255 chars. Is such sequence can be called "extension"? I do not think so.

I see problem there: malefactor can send file with name longer then 255 chars. I don't know, is it problem does matter at all. If it does matter let's do strict check. If it is doesn't matter, let's remove this check at all.

I think the tests should be moved to file_uploads/, next to the one that tests the truncating functionality [1].

I would also rewrite them to immitate the test_filename_overflow test, which I think tests the issue more accurately: we want to make sure that an uploaded file doesn't have a name longer than 255 characters.