mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 12:08: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 = [
|
||||
ip: remote_ip,
|
||||
fingerprint: fingerprint(conn, conn.path_info),
|
||||
referrer: conn.assigns.referrer,
|
||||
referrer: referrer(conn.assigns.referrer),
|
||||
user: user,
|
||||
user_agent: user_agent(conn)
|
||||
]
|
||||
|
@ -47,4 +47,7 @@ defmodule PhilomenaWeb.UserAttributionPlug do
|
|||
defp fingerprint(conn, _) do
|
||||
conn.cookies["_ses"]
|
||||
end
|
||||
|
||||
defp referrer(nil), do: nil
|
||||
defp referrer(r), do: String.slice(r, 0, 255)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue