mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 01:54:34 +03:00
added a test and changed hashmode condition (#2082)
This commit is contained in:
parent
99fd101135
commit
a058cf6240
@ -273,7 +273,7 @@ defmodule PlausibleWeb.Api.ExternalController do
|
||||
|> URI.decode()
|
||||
|> String.trim_trailing()
|
||||
|
||||
if hash_mode && uri.fragment do
|
||||
if hash_mode == 1 && uri.fragment do
|
||||
pathname <> "#" <> URI.decode(uri.fragment)
|
||||
else
|
||||
pathname
|
||||
|
@ -842,6 +842,22 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
|
||||
assert pageview.pathname == "/#page-a"
|
||||
end
|
||||
|
||||
test "does not record hash when hash mode is 0", %{conn: conn} do
|
||||
params = %{
|
||||
n: "pageview",
|
||||
u: "http://www.example.com/#page-a",
|
||||
d: "external-controller-test-hash-0.com",
|
||||
h: 0
|
||||
}
|
||||
|
||||
conn
|
||||
|> post("/api/event", params)
|
||||
|
||||
pageview = get_event("external-controller-test-hash-0.com")
|
||||
|
||||
assert pageview.pathname == "/"
|
||||
end
|
||||
|
||||
test "decodes URL pathname, fragment and search", %{conn: conn} do
|
||||
params = %{
|
||||
n: "pageview",
|
||||
|
Loading…
Reference in New Issue
Block a user