Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(favicons): cache shows wrong Google Docs icons #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gabetax
Copy link

@gabetax gabetax commented May 26, 2024

When this plugin fetches favicon URLs, it uses a basic Map to cache the favicon response bodies in memory. Previously this Map was keyed using the hostname of the URL in the block content. However, this caused an incompatibility with hard-coded path-specific exceptions that this plugin implements for Google Docs.

So, if you have the following Logseq page:

- https://docs.google.com/document/xxx
- https://docs.google.com/spreadsheets/xxx
- https://docs.google.com/presentation/xxx

The cache would side-step the path-specific checks, and all the links would display the same icon:
Screenshot 2024-05-26 at 9 38 53 AM

This change shifts the cache around just the fetch of the favicon, and uses the favicon's URL as the cache key. Note this means the cache is no longer covers the conditionals in getFaviconData, but this should be a minimal tradeoff for displaying the correct icon.

Fixes #49

When this plugin fetches favicon URLs, it uses a basic Map to cache
the favicon response bodies in memory. Previously this Map was keyed
using the hostname of the URL in the block content. However, this caused
an incompatibility with hard-coded path-specific exceptions that this
plugin implements for Google Docs.

So, if you have the following Logseq page:

```md
- https://docs.google.com/document/xxx
- https://docs.google.com/spreadsheets/xxx
- https://docs.google.com/presentation/xxx
```

The cache would side-step the path-specific checks, and all the links
would display the same icon.

This change shifts the cache around just the fetch of the favicon, and
uses the favicon's URL as the cache key. Note this means the cache is no
longer covers the conditionals in getFaviconData, but this should be a
minimal tradeoff for displaying the correct icon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google icons do not belong to the right web
1 participant