Anki 26.09.2 lowercases filenames of added media

After updating today to 26.09.2 (bb0dd6d1)⁩, adding media to cards becomes broken if it has uppercase letters in its filename.

I use ames to add media (audio and photo) to cards. For audio, it generates a random tmp filename, e.g. ffmpeg-recording.IdbHeq.opus, but since this update, the filename in the media folder has become getting lowercased (ffmpeg-recording.idbheq.opus) while ames adds to the field the original filename ([sound:ffmpeg-recording.IdbHeq.opus]).

This isn’t new as of 26.09. See these earlier threads for ways to make that tool work with Anki.

I looked at the ames.sh script. It might be relatively easy to modify it to lowercase the names passed along to AnkiConnect when updating the notes. For example:

 store_file "$converted_path"
-update_img "$(basename -- "$converted_path")"
+local -r prefix=$(echo $converted_path | cut -d . -f 1)
+local -r original_uid=$(echo $converted_path | cut -d . -f 2)
+local -r suffix=$(echo $converted_path | cut -d . -f 3-)
+local -r lower_uid=$(echo $original_uid | tr '[:upper:]' '[:lower:]')
+local -r note_path=$prefix.$lower_uid.$suffix
+update_img "$(basename -- "$note_path")"

I updated Anki today and it started happening. Maybe my previous version wasn’t up-to-date, dunno.

Checked the GitHub - it seems to have happened on 26.05

Improve handling of media files differing only in letter case by @iamllama in #4355 #4851 #4860 #4861 #4852


Oh, didn’t see those threads. Should have searched better.


I checked AnkiConnect docs and found that media can be added right via updateNoteFields so no need to deal with filename changes at all. Sent PR to ames.