Signal-desktop: Link preview fetches low-quality icon when higher resolution is available

Created on 31 Jan 2021  路  3Comments  路  Source: signalapp/Signal-Desktop

I found this issue for www.zeit.de, a German news website. It provides an apple-touch-icon-precomposed link:

<link rel="shortcut icon" sizes="16x16 32x32" href="https://www.zeit.de/favicon.ico">
<link rel="apple-touch-icon-precomposed" href="https://img.zeit.de/static/img/ZO-ipad-114x114.png">

Signal doesn't load the high-quality icon which leads to a rather poor-looking preview:
image

WhatsApp for comparison:
image

Version: v1.39.6

Bug Good starter task

Most helpful comment

Thanks for reporting.

This is happening for two reasons:

  1. We don't try to load apple-touch-icon-precomposed icons
  2. We don't necessarily pick the largest icon

You can see the logic here:

https://github.com/signalapp/Signal-Desktop/blob/172598b35499c3846328c769864b7bc5ddb9ae98/ts/linkPreviews/linkPreviewFetch.ts#L354-L360

It would be great if someone could make a pull request to help us with this change. Currently, the order is:

  1. og:image
  2. og:image:url
  3. shortcut icon
  4. icon
  5. apple-touch-icon

The new order should be:

  1. og:image
  2. og:image:url
  3. apple-touch-icon
  4. apple-touch-icon-precomposed
  5. shortcut icon
  6. icon

Here's how I'd do that:

  1. Get the app running. See our contribution instructions.
  2. Add tests to linkPreviewFetch_test.ts. Run the tests with yarn test-node and watch them fail.
  3. Fill in the code in linkPreviewFetch.ts.

All 3 comments

Thanks for reporting.

This is happening for two reasons:

  1. We don't try to load apple-touch-icon-precomposed icons
  2. We don't necessarily pick the largest icon

You can see the logic here:

https://github.com/signalapp/Signal-Desktop/blob/172598b35499c3846328c769864b7bc5ddb9ae98/ts/linkPreviews/linkPreviewFetch.ts#L354-L360

It would be great if someone could make a pull request to help us with this change. Currently, the order is:

  1. og:image
  2. og:image:url
  3. shortcut icon
  4. icon
  5. apple-touch-icon

The new order should be:

  1. og:image
  2. og:image:url
  3. apple-touch-icon
  4. apple-touch-icon-precomposed
  5. shortcut icon
  6. icon

Here's how I'd do that:

  1. Get the app running. See our contribution instructions.
  2. Add tests to linkPreviewFetch_test.ts. Run the tests with yarn test-node and watch them fail.
  3. Fill in the code in linkPreviewFetch.ts.

@RussianCow have you picked this up?

@yakkomajuri Yes! Sorry for not letting anyone know鈥擨 thought I would at least give it a shot before I said anything, and it ended up being a pretty simple change. I'm currently having trouble setting up the development branch locally as per #4995, but I haven't dug that deep into it yet and likely won't get to it this weekend. My change works off master, though.

Was this page helpful?
0 / 5 - 0 ratings