a tool for shared writing and social publishing

Fix SVG site.standard.publication logos #58

Open jack.is
Open opened by jack.is

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_images that ensures only images are grabbed via getBlob. It probably would make sense to either:

  • don't proxy anything that isn't a mime type of image/*
  • if the mime-type is not image, just return 415 unsupported media type
Sign up or Sign in to add to the discussion.