mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
Truncate incoming referrer string (#260)
This commit is contained in:
parent
65da36369d
commit
b235f545f2
1 changed files with 4 additions and 1 deletions
|
@ -24,7 +24,7 @@ defmodule PhilomenaWeb.UserAttributionPlug do
|
||||||
attributes = [
|
attributes = [
|
||||||
ip: remote_ip,
|
ip: remote_ip,
|
||||||
fingerprint: fingerprint(conn, conn.path_info),
|
fingerprint: fingerprint(conn, conn.path_info),
|
||||||
referrer: conn.assigns.referrer,
|
referrer: referrer(conn.assigns.referrer),
|
||||||
user: user,
|
user: user,
|
||||||
user_agent: user_agent(conn)
|
user_agent: user_agent(conn)
|
||||||
]
|
]
|
||||||
|
@ -47,4 +47,7 @@ defmodule PhilomenaWeb.UserAttributionPlug do
|
||||||
defp fingerprint(conn, _) do
|
defp fingerprint(conn, _) do
|
||||||
conn.cookies["_ses"]
|
conn.cookies["_ses"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp referrer(nil), do: nil
|
||||||
|
defp referrer(r), do: String.slice(r, 0, 255)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue