-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Writing to external storage using SAF leads to file corruption if the filename includes square brackets [] #337
Comments
What could the app do about it? People might whant to keep their brakcets in filenames in working cases ... |
Silent corruption is the worst. At the very least, it can throw an error telling the user to rename their files appropriately. |
yes, that is surly true.
Hhmm, not sure if a specific error message would make it's way through to be displayed on client. The server could log such cases or show them as toast. But both can easily been overseen. I'll check error message handling.
Are you sure the root cause is not in android itself?
That would be escaping. The question here is: what kind of escaping would help? Backslash would be a common escaping mechanism. It's not clear if it would help here. And it is also unclear if other characters would be affected, too. |
Ok, error messages make it through to client. Therfore checking for known bad characters and failing has been added. |
After more testing: |
good to know.
Depends on where you look at. As this app is written in java the code itself supprots unicode. But it is not clear to me how protocols (ftp and sftp) handle encodings (can be figured out, takes some time) and what SAF actually does. |
@wolpi I've been uploading files with square brackes using SAF for years with this server, never had any problem and now I just can't upload such files. (Version: 7.2 (code: 65), Android 14) |
@gogiii You idiot, the very first line of my issue is "It doesn't happen when writing to internal storage using PlainOldFS", and WTF exFat has to do with SD card?! It's actually a HDD. |
@r3a1d3a1 rofl. Not happens both for plainoldfs and saf for me on internal storage. The brackets are legal symbols for exfat, so potentially the problem is your device, sdcard/hdd or the way you use the command which you still didn't present to us. |
My device is perfect :P You're lying. |
I've tried to find any spec that says [] are illegal characters in file names (SFTP, FTP, Android DocumentFile), but can't. Even tested on Android 9, SD card, FAT32: Total Commander renames files to/from with [] chars in their name. So i think this filename checking should be reverted, the root cause seems to be somewhere else. |
Then we need your logs that shows what is the exact root cause of the issue, because we can't reproduce this. This is dangerous on your system, it should be handled by the server only if this is a general problem. If it fails only there, why should we disable this everywhere? So instead of dumb pictures, plese share some logs. |
It's unlikely to find anything in the logs since it finishes "successfully". Best way to triage is to get hands-on with an Android TV or preferably an Nvidia Shield. In the meantime, since it can cause irreversible damage, it's best to keep it contained the way it is. How would you like your files getting screwed w/o you even knowing?! |
I'm going to allow those 2 characters again. As next release is still months away it will stay for some time as is. |
Btw, I forgot to mention I use |
It doesn't happen when writing to internal storage using PlainOldFS.
The client I'm using is ncftp. The server (code: 63) runs on an Nvidia Shield (OS 9.1). The external storage is formatted as exFat.
The corruption is silent, hence no errors on client or server side. It's in the form of missing the first 100KBs of a file of 100MBs size.
Removing the brackets from the filename solves the issue, but since the corruption happens silently, it's quite dangerous.
The text was updated successfully, but these errors were encountered: