Skip to content
Snippets Groups Projects
Unverified Commit 81cdb013 authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

[Fixes #11147] Strip port from visitor_ip_address (#11148) (#11150)


* strip port from visitor_ip_address

* gix PEP

(cherry picked from commit 6887596c)

Co-authored-by: default avatarGiovanni Allegri <giohappy@gmail.com>
parent b045b0fb
No related merge requests found
......@@ -259,6 +259,8 @@ def visitor_ip_address(request):
ip = x_forwarded_for.split(",")[0]
else:
ip = request.META.get("REMOTE_ADDR")
if ip:
ip = re.match(r"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", ip)[0]
return ip
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment