Pasting some image from Chrome won't import the image to the media database

Steps to reproduce:

  1. Go to this URL
    https://www.researchgate.net/publication/372533503/figure/fig1/AS:11431281270911835@1723283890520/Carotid-sinus-and-carotid-body-The-carotid-sinus-nerve-a-branch-of-the-glossopharyngeal.jpg

  2. Copy the image

  3. Paste that to Anki.

  4. Notice the 403 error and the resulting image. src attribute pointing to remote URL, rather than downloading the media.

Gonna make a PR for this. Leaving this post as a reminder.

See Revert "Prefer image pastes over HTML in the editor (#2856)" Ā· ankitects/anki@174a2e7 Ā· GitHub

Are you on a vpn?

1 Like

Oh, this had already been discussed.

No, I’m not behind any VPN. It seems like some sites don’t like Anki’s user agent or so.

1 Like

This thread is also related:

1 Like

Posted a quick PR draft. This pr conserves filename and alt when the download succeeds.

1 Like

For record, I think anki should download the original image whenever possible instead of using the clipboard data, as it would allow…

  • Animated GIF
  • Image with transparency (may not be respected on the clipboard)
  • Lossless embedding of non-jpg images.