Images incorrectly marked as unused when checking media due to special characters in <img> tag

I noticed some image are incorrectly marked as unused when checking media. After some experiments, I found out the problem arises from image usages like this: <img alt="<123>" src="123.jpg"> . It seems that the program incorrectly considers the “>” symbol in the “alt” field as the end of the <img> tag.

Such cases cannot be avoided by users because, some time ago, Anki started automatically including the alt field in the img tag when pasting an image from the Internet. Some images from the Internet do contain special characters in the alt field. Such images are pasted into anki with special character in their alt field without notice, and users may mistakenly delete them when checking media.

Thanks, I’ve logged this on Media regexes get confused by angle brackets in img tags · Issue #2913 · ankitects/anki · GitHub

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.