The file name is displayed correctly in the file-sending window and initially in the chat, but the modified name can already be seen in the preview of the sent message and is also used as the suggested name when saving the file.
The length of the file name affects the issue. The example above is the shortest tested name for which the bug occurs. Removing one character (65 → 64 characters) makes the problem disappear:
Create and save a file on the computer with the name 2021-04-10_text_file_test_file_test_file_test_file_test_buggy.txt.
Send the file to Saved Messages.
Check the file-sending window.
Check the file name displayed in the chat.
Check the preview of the sent message.
Save the file and check the suggested file name.
Current result
The dash in the long file name is replaced with an underscore after the file is sent. The changed name is visible in the message preview and is also used as the suggested file name when saving the file.
The issue occurs with the 65-character example above but disappears when the name is shortened by one character to 64 characters.
Expected result
The original file name should remain unchanged throughout the process:
The original file on the computer.
The file name displayed in Telegram.
The file name suggested when saving the file from Telegram.
Same problem. Also, filename length has wrong limit in bot API) I use own bot API server with patched length of filename and replace underscore to dash in needed places)
Why Telegram rename files from bot?