ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.51k stars 2.21k forks source link

Problem with media file names that are identical except for capitalization #5432

Closed LucasLang closed 1 year ago

LucasLang commented 5 years ago
Reproduction Steps

In the Anki desktop app for Linux, add two new cards A and B and include media files A.png and a.png, respectively. Synchronize via ankiweb with Ankidroid.

Expected Result

Card A will show the image A.png and Card B will show the image a.png under Ankidroid.

Actual Result

Both cards show the image A.png.

Debug info

AnkiDroid Version = 2.8.4

Android Version = 5.0.2

ACRA UUID = 80fb310c-724c-48cd-818c-0701c723bb2a

Research

Enter an [ x ] character to confirm the points below:

[ x ] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid

[ x ] I have checked the manual and the FAQ and could not find a solution to my issue

[ x ] I have searched for similar existing issues here and on the user forum

pablode commented 5 years ago

I've had a look into this issue and I don't think this is an AnkiDroid problem which can be fixed.

First of all, for viewing the cards, AnkiDroid uses a system-provided WebView (e.g. Chrome) which does all external file loading. This works perfectly fine, except that one of the files you mentioned, a.png or A.png doesn't exist to begin with. The synchronization process also is not at fault here.

The underlying issue is the filesystem which is being used by the app - but even that answer might be too simple, because Android does some abstruse things under the hood.

On my Samsung Galaxy S7 with developer mode enabled, I used adb shell to access the device and to navigate to the folder where the AnkiDroid data was stored. I then tested the filesystem for case sensitivity:

--- ~ » adb shell
hero2lte:/ $ cd /sdcard
hero2lte:/sdcard $ touch hi
hero2lte:/sdcard $ touch HI
hero2lte:/sdcard $ ls
Alarms  Android  AnkiDroid  DCIM  Download  Movies  Music  Notifications  Pictures  Playlists  Podcasts  Ringtones  hi
hero2lte:/sdcard $ rm hi

Only the first file was created.

On Android, the mountpoint /sdcard usually refers to some kind of internal storage rather than to an SD card. In fact, most Samsung phones and Android versions above or equal to Oreo use an in-kernel virtual file system wrapper, SDCardFS, which emulates FAT32 [1]. Older non-Samsung devices may instead use a FUSE-based FAT32 emulation approach [2].

FAT32 is case-insensitive [3], meaning that it doesn't matter if you want to open or create a.png or A.png - you are referencing the same entry. We are not able to change this, however, since FAT32 is also case-preserving [4], we could detect this behaviour and emit some kind of warning.

github-actions[bot] commented 4 years ago

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

dae commented 1 year ago

I don't see how this is something Anki can address better - some platforms are case-sensitive, and others aren't. Check media will warn you if the case of the filename doesn't match the case on disk.