Gallery
Gallery copied to clipboard
Renaming: if filename too long, file gets irrecoverably deleted without warning
Checklist
- [X] I can reproduce the bug with the latest version given here.
- [X] I made sure that there are no existing issues - open or closed - to which I could contribute my information.
- [X] I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
- [X] I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
- [X] I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
- [X] This issue contains only one bug.
- [X] I have read and understood the contribution guidelines.
Affected app version
1.1.1
Affected Android/Custom ROM version
Android 9 to 11
Affected device model
diverse
How did you install the app?
F-Droid / IzzyOnDroid
Steps to reproduce the bug
I'm experiencing a severe, reproducible bug in Fossify Gallery 1.1.1 that unexpectedly deletes media files without warning.
I can be reproduced as follows:
- open Fossify Gallery
- navigate to any media file and tap to display it
- in the three-dots menu, tap "Rename"
- in the dialog field that opens, enter a new, very long filename.
Expected behavior
Fossify Gallery should either rename the file or, if the new name is too long, reject the invalid renaming operation, issue a brief explanation and leave the file intact.
Actual behavior
If the new filename happens to be too long (even if by just one character - there is no indication!), tapping "OK" will immediately DELETE the file, then merely informing you that "An unknown error occurred".
Screenshots/Screen recordings
No response
Additional information
Please note that the concerned file is not moved to Fossify Gallery's "Recycle Bin" nor to "Recovered", but fully removed from the file system.
Also note that this bug appears to be specific to Fossify Gallery (aside from Simple Gallery Pro): None of the three other gallery app or file managers I've tested on the same devices display this dangerous behaviour.
@Aga-C re: niche
I agree this bug doesn't affect everyone - many users who tend to keep original filenames anyway, might never run into it.
However, it's certainly not overly exotic to use file names to be indicative of their respective contents, e. g. in documenting video recordings. If there are multiple aspects you want to be able to categorize or search those files for, filenames can get lengthy. But since Fossify Gallery fails to verify the input and also doesn't give any indication of remaining chars, it's dangerously easy to then run into this issue.
The severity of consequences in that case is very high, so I'd greatly appreciate if this bug didn't get buried.^^
A simple input length limitation to e. g. 200 chars would already do the trick. Thank you for considering! :-)
Running GrapheneOS on Pixel 7Pro. Long filename doesn't seem to cause issues in my case.
Just a thought: is it possible that filename gets truncated and it ends up without extension, rather than being deleted? Gallery wouldn't show it, if it misses the extension, and it would appear as if it was deleted. Perhaps who encountered this issue could check the actual presence of a file with truncated name?
Running GrapheneOS on Pixel 7Pro. Long filename doesn't seem to cause issues in my case.
The filename in your screenshot is less than 200 bytes long. In my tests, this bug is triggered if the new name (including extension) exceeds 255 bytes.
Here's a silly but illustrative example of a 255 B name, i. e. the maximum length allowed:
As soon as an attempt is made to add one more character to that name by renaming it in Fossify Gallery, the file vanishes from the system.
Just a thought: is it possible that filename gets truncated and it ends up without extension, rather than being deleted?
Filename extensions don't seem to matter for this bug, it occurs even if the new, long name entails multiple extensions. According to file managers I have checked for a file with the new name, as well as ls -l or find in termux, there is no such file (anywhere), neither with nor without extension.
That's no surprise since it's common for file systems to reject overly long filenames. The problem at hand isn't the length limitation imposed by the file system, but rather the way Fossify Gallery handles that limitation.
Adding a file that triggers this. I was trying to rename this file to Sick of people calling everything in crypto a Ponzi scheme. Some crypto projects are pump and dump schemes, while others are pyramid schemes. Others are just standard issue fraud. Others are just middlemen skimming of the top. Stop glossing over the diversity in the industry.. (I did not touch the Extension field, but it was png).
I'm aware that's a ridiculous filename but I sometimes copy and paste the whole text of a tweet for searching later.
If you remove the comma after 'pump and dump schemes' the issue doesn't happen. But I have experienced this with filenames without commas so I don't think commas are the issue.
I used another gallery app (https://f-droid.org/en/packages/deckers.thibault.aves.libre/) to rename the file using the string that triggered the issue and it worked with no problems.
@pkoepke I've tested the filename you provided and cannot confirm your observation regarding the comma on my phone. The file vanishes with and without comma alike.
Are you sure you successfully renamed the file to Sick of people calling everything in crypto a Ponzi scheme. Some crypto projects are pump and dump schemes while others are pyramid schemes. Others are just standard issue fraud. Others are just middlemen skimming of the top. Stop glossing over the diversity in the industry.png in any app, let alone in Fossify Gallery? Does the file with that name still exist on your Android system, or has the name been pruned?
That name is 278 characters long, 23 more than (AFAIK) the maximum allowed length of filenames in typical Android setups. The "comma" vs. "no comma" difference would make a lot of sense if the filename was exactly 23 characters shorter, i. e. 256 characters with the comma (too long), or 255 without (OK). - Any chance you omitted some part of the name in those renaming attempts that worked?
Ah ha, looks like I cut some words to make it work. The actual filename is Sick of people calling everything in crypto a Ponzi scheme. Some are pump and dump schemes others are pyramid schemes. Others are just standard issue fraud. Others are middlemen skimming of the top. Stop glossing over the diversity in the industry.png, which as you note is within the character limit.
But I think you are misunderstanding the issue. The problem isn't that the length of file names is capped. That's not under your control. The problem is while other apps will either refuse to rename the file or will truncate file names that are too long, Fossify Gallery throws an error and somehow loses/deletes the file. The problem isn't the file name limit, it's losing the file.
@pkoepke
Ah ha, looks like I cut some words [...]
I see - I guessed so.
But I think you are misunderstanding the issue. [...]
Any chance you're again missing something here? - This issue #129 has been filed by myself. Whilst in theory, I could be misunderstanding my own issue, that doesn't seem to be the case here, as your explanation mainly rephrases some points already established before, from the Additional information in my OP to the conclusion just before your first post.
The problem isn't the file name limit, it's losing the file.
Right, or more exactly: The problem is losing the file without warning by renaming it in Fossify Gallery to a new name that exceeds the file name length limit.
Debugging it could well be facilitated by new insights, and in your first post, there were two candidate points that, if they were true, would raise entire new questions:
- The idea that renaming to a 279 characters long name (including the comma) worked without problems in Aves Libre.
- The idea that omitting the comma would enable Fossify Gallery to gracefully rename the file to the then still 278 characters long new filename.
However, as we can see by now, both ideas don't hold:
- Aves Libre kept the file (as expected), but did prune the filename (also expected), so it wasn't renamed to 279 characters.
- Renaming the file in Fossify Gallery made it vanish (with or without comma, as expected) unless the new name was previously shortened to obey the 255 character limit, in which case renaming succeeded (with or without comma, also expected).
So unfortunately, no new insights there.
Gotcha, I follow now. If there's something I can do to provide more info e.g. triggering the error and sending logs, let me know.
Geez, after a lengthy break I've returned to Fossify Gallery - and ended up sending another irreplacible video documentation into the void! Spent 3 hours on recovery attempts by now, to no avail. (Perhaps the likes of photorec could help if this device was rooted, but it isn't.)
I should have remembered the bug, but really, it's so insidious I fail to reliably get myself into the required high-alert state of mind everytime I rename a file in a gallery app.
It doesn't help that there's obviously no one to blame but me. The only viable safeguard against such disasters that I can see right now is to stop using Fossify Gallery entirely.
Needless to say, I'd greatly appreciate if this tarantula of a bug was finally removed from Fossify Gallery, making that otherwise very handy app usable in a safe manner. I'll check here every now and then.
EDIT: @naveensingh Now that's incredible ... I see right now you've self-assigned this issue while I was writing this comment! Thank you in advance!
I switched to Aves until this is fixed: https://play.google.com/store/apps/details?id=deckers.thibault.aves