Image discrepancies in Anking deck cause them to show up as missing despite them being in collections.media folder

Anki tells me I am missing images even though I have them in my collections.media folder.

I think its because the filenames of these images either have spaces which comes up as β€œ%20” in html but not in the image filename or bec the image type is JPG vs jpeg or png vs PNG

Here are the images that show up for me as missing right after I unsubscribed and resubscribed

1. 1d9a4677e1cbfe0b3072761373e1e18e.JPG
2. 2bfaee6df64a28dc802483a19aa9806c.JPG
3. 5bfc0525b509f40374a0bef8572e3c72.png
4. Indications%20for%20Dialysis.png
5. Screen%20Shot%202017-01-19%20at%208.43.59%20PM.png
6. Screen%20Shot%202019-09-03%20at%208.38.11%20AM.png
7. Screen%20Shot%202019-09-26%20at%208.12.52%20AM.png
8. Screen%20Shot%202019-10-09%20at%208.13.23%20AM.png
9. Screen%20Shot%202019-12-19%20at%206.08.26%20PM.JPG
10. Screen%20Shot%202020-01-28%20at%206.32.02%20PM.png
11. Zoverall%20picture%20(4)_1566160514431.jpg
12. Zoverall%20picture%20(47)_1566160514431.JPG
13. Zoverall%20picture%20(86).JPG
14. c6224c2ea3f0c7f29a7dc25af3be4fe4.png
15. dang%20(3).png
16. double%20kawasaki!.png
17. drug%20induced%20acne.png
1 Like

Some of these cards are images Ive accepted from users a bit ago, weird why some are not showing up, the fields should be syncing now

This one should be fixed now, this is one of the creative common image glitches, i just screenshotted the image and put it in and reset local changes and I can see it now

1d9a4677e1cbfe0b3072761373e1e18e.JPG

nid:1484704008515

5bfc0525b509f40374a0bef8572e3c72.png

This one is Ahmed Afifis image I accepted this morning, its not syncing for some reason, even after adding AnkiHub_ImageReady::Extra (I thought that might be the issue but nothing happened)

Some of the images display in the card but they still come up as missing

That’s a known Anki issue that’s been going on for a while

Running this code in the debug console should fix the space issue:

from aqt import mw

deck = 'AnKing Overhaul for Step 1 & 2'
updated_notes = set()
for nid in mw.col.find_notes(f'"deck:{deck}"'):
    note = mw.col.get_note(nid)
    for i in range(len(note.fields)):
        updated_contents = mw.col.media.escape_media_filenames(note.fields[i], True)
        if note.fields[i] != updated_contents:
            note.fields[i] = updated_contents
            updated_notes.add(note)
mw.col.update_notes(updated_notes)
print(f'updated {len(updated_notes)} notes')

Maybe it’s worth applying this to the whole deck. It only made Anki report 7 less missing files for me in a fresh installation of the deck though.

It updated 13 for me

>>> from aqt import mw
... 
... deck = '(1) AnKing Overhaul for Step 1 & 2'
... updated_notes = set()
... for nid in mw.col.find_notes(f'"deck:{deck}"'):
...     note = mw.col.get_note(nid)
...     for i in range(len(note.fields)):
...         updated_contents = mw.col.media.escape_media_filenames(note.fields[i], True)
...         if note.fields[i] != updated_contents:
...             note.fields[i] = updated_contents
...             updated_notes.add(note)
... mw.col.update_notes(updated_notes)
... print(f'updated {len(updated_notes)} notes')
updated 13 notes

This is the only errors I get now

Notice how the filenames only differ by the extension for the ones that it says are not being used in any card and 2 of the ones that they say are missing