Fix favicons for domains including a subfolder (#5258)
* fix favicons for subfolder domains * changelog * rename source -> domain
This commit is contained in:
parent
487e3d81b4
commit
7e248d07ca
|
|
@ -41,6 +41,7 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
### Fixed
|
||||
|
||||
- Fix fetching favicons from DuckDuckGo when the domain includes a pathname
|
||||
- Fix `visitors.csv` (in dashboard CSV export) vs dashboard main graph reporting different results for `visitors` and `visits` with a `time:minute` interval.
|
||||
- The tracker script now sends pageviews when a page gets loaded from bfcache
|
||||
- Fix returning filter suggestions for multiple custom property values in the dashboard Filter modal
|
||||
|
|
|
|||
|
|
@ -94,9 +94,13 @@ defmodule PlausibleWeb.Favicon do
|
|||
"/favicon/sources/placeholder" ->
|
||||
send_placeholder(conn)
|
||||
|
||||
"/favicon/sources/" <> source ->
|
||||
clean_source = URI.decode_www_form(source)
|
||||
domain = Map.get(favicon_domains, clean_source, clean_source)
|
||||
"/favicon/sources/" <> domain ->
|
||||
domain = URI.decode_www_form(domain)
|
||||
|
||||
domain =
|
||||
Map.get(favicon_domains, domain, domain)
|
||||
|> String.split("/", parts: 2)
|
||||
|> hd()
|
||||
|
||||
case HTTPClient.impl().get("https://icons.duckduckgo.com/ip3/#{domain}.ico") do
|
||||
{:ok, %Finch.Response{status: 200, body: body, headers: headers}}
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ defmodule PlausibleWeb.FaviconTest do
|
|||
assert conn.resp_body == "favicon response body"
|
||||
end
|
||||
|
||||
test "requests favicon from DDG when domain contains a forward slash", %{plug_opts: plug_opts} do
|
||||
test "requests favicon from DDG by hostname only (strips pathname)", %{plug_opts: plug_opts} do
|
||||
expect(
|
||||
Plausible.HTTPClient.Mock,
|
||||
:get,
|
||||
fn "https://icons.duckduckgo.com/ip3/site.com/subfolder.ico" ->
|
||||
fn "https://icons.duckduckgo.com/ip3/site.com.ico" ->
|
||||
{:ok, %Finch.Response{status: 200, body: "favicon response body"}}
|
||||
end
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue