Just wanted to let you know that a fix for this has been created:
https://github.com/discourse/discourse/commit/44153cde18e4f4f3d3c5719e3e7c96b5954f25c8
The issue that I resolved actually was the - and uppercase letters in the extension and not the length. The link to download the file will still be truncated, but the actual file you download will have the full file extension.