Opening here before PR as there's a little bit of discussion to be had:
The root cause of it is that leaflet is using
"Accept-Encoding": "gzip, deflate, br, zstd",
for the blob fetches, but PDSes are returning png/jpeg/etc as uncompressed, so that buffer gets sent right through on in 99% of cases.
Since SVGs are text however, that means they'll get gzipped via getBlob on the PDS and returned to api/atproto_images. We now have a gzip without content-length, and that gets sent to the browser, which interprets it as a 0 length response.
Option 1:
"Accept-Encoding": "identity",
Now we never request any compression, which has no impact on png/jpeg/etc, but ensures that we get SVG as identity, which includes a content-length as expected.
Trade-off, asking for a massive blob results in the full blob being sent over the wire.
Option 2:
Recognize and decompress compressed files. This feels like more trouble than it's worth given that it would only apply to SVGs
Follow-on note, there's nothing in
api/atproto_imagesthat ensures only images are grabbed via getBlob. It probably would make sense to either:image/*