TokTok / c-toxcore

The future of online communications.
https://tox.chat
GNU General Public License v3.0
2.28k stars 286 forks source link

In file transfer, transmission of a file with long file name fails #612

Open ua7 opened 6 years ago

ua7 commented 6 years ago

I moved here from the issue below. https://github.com/qTox/qTox/issues/4791 In file transfer, transmission of a file with long file name fails. If you only use the English alphabet for filenames, this problem will not happen. If you create a file with long filenames in Chinese or Japanese, file transmission will fail before starting transmission. All I want to transfer is a file that Windows system can handle normally completely on a daily basis. Other similar types of software, such as skype, can transfer them without problem. Only Tox will fail. I would appreciate you if you could mercifully imagine that it is how inconvenient that about half of the files handled on a daily basis can not be transferred . I was told that in the advice I received on the above issue, the cause is may be that tox_core 's tox_max_filename_length is 255. Even in Windows 7 environment of multibyte character language, file name can be used up to 255 characters with full path. The number of bytes required for one character is variable and consumes 1 to 6 bytes. Chinese and Japanese characters are at least 2 bytes. So would you please let tox prepare more than 515 bytes for the file name buffer? Ideally we might need 1536 bytes, but in my sense, if it is 255 bytes so far, then 515 bytes is probably enough. Alternatively, we propose to allow the user to specify the size of the file name buffer in the setting of the client software.

LittleVulpix commented 6 years ago

I would like to point out that the problem here might be a limitation of linux filesystems such as zfs, ext3/4 and the like. As stated above, whilst NTFS stores filenames per "character" as in "one distinguishable symbol", the linux filesystems generally put the restriction on bytes. This means that any filename consisting of more than 255 bytes but fewer than 255 characters you can without any issues store and work with in windows, but will not be a valid filename in Linux. What should toxcore do in this case? I recently became aware of this when I tried copying some ~180character japanese-named file onto my zfs-using NAS and found out that none of my linux systems could store the filename as is.