-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Adding an image to a card overwrites the file name #6622
Comments
Result of #6543. @mikehardy |
Yeah, there is an opposite case where if we don't rename the image there can be collisions. The "horrible" construct is otherwise known as a "unique name" ;-) So I want to say that as Anki ingests media there can be no guarantee of filenames that result, I think that is a correct statement, and I think stating otherwise is technically wrong. The following is based on that. From a user experience perspective, what would work for you? User messaging with the ability to copy to clipboard the message we will use internally? I'm not sure the best way to handle it, all I know for sure is that if we don't create guaranteed unique names there are other problems. |
Haha, sorry for the "horrible", it's just my user experience and a file name that exceeds my phone's screen is really unpleasant. Question: why do we need to rename the images? Anki desktop saves them as they are. And beforehand it checks for name conflicts and renames the image to "test (1).jpg" if "test.jpg" already exists. |
Ah, I should explicitly recognize that any choice that proposes a limited number of options is the "fallacy of false choice" So Desktop is handling the collision, but they're generating unique names that users like. Our current "unique name" algorithm is provably unique but sucks for users (I'll grant that!) So a proposed solution would be:
...and to again recognize the false choice, anything is possible (within reason) if you have a cleaner idea? |
Perfect!
Perfect!
Anki desktop doesn't do this. But yes, a message that "xyz.jpg" already exists and thus was renamed to "xyz (n).jpg" would be a hell of a clean approach. |
Great, I'll see what I can do - it shouldn't be too much of a change vs the current state after the crop PR landed |
Another Proposal:
|
Yeah - the implementation could follow that path - the cache step (before moving to collection) is independent |
Or if it is easier to implement, then here's another idea:
This would also solve one of my other issues: #5192 :-D |
That could also work. I'll consider both when I set up tools in the area and start work |
FWIW, recent Anki versions will append a hash of the content to the filename on a conflict. Some workflows always used the same filename (eg "image.jpg"), and as the numbers increment and are predictable, (1), (2) and so on could lead to conflicts with different files added on another device prior to syncing. |
Very interesting @dae ! thanks for that tidbit. @Anthropos888 this is unfortunately a strike against the idea of keeping the "make name unique" method producing really nice names if we have direct experience it has failure modes. I'll have to think on this but based on the new experience shared by Damien I'm thinking that any proposed fix would still have a nasty-looking name as a main component (possibly with editing power, but defaulting to a big ugly name). |
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically |
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically |
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically |
Reproduction Steps
Expected Result
The image "test.jpg" will be copied to the collection folder
Actual Result
Instead, the image will be renamed to some horrible construct like img_202007050926164513682973119384157.jpg
Some of my decks rely on the image file name that I choose myself, so by renaming them automatically the deck doesn't work anymore :-(
Also I didn't realize this automatic change before because there's no such message. Therefore I would recommend to show a message that the image was renamed OR show the file name below the (recently added display of the) image size (which would be a useful information anyway).
Debug info
AnkiDroid Version = 2.12.0beta3
Android Version = 9
ACRA UUID = 1f29f610-893a-403f-83d5-25a26ba97fe0
Research
Enter an [x] character to confirm the points below:
The text was updated successfully, but these errors were encountered: