summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorParth Verma <v.parth98@gmail.com>2023-11-23 20:46:17 -0800
committerGitHub <noreply@github.com>2023-11-24 05:46:17 +0100
commiteabfa2d0e38670365aa74117ad2f8710b81065c5 (patch)
tree9bc97757f38e4e6e5e9bb26dd1cf77c4df2cf8f2 /django/utils
parenta8adb6aa6cc6b9efd043acc980b5744bc211c760 (diff)
Fixed #34818 -- Prevented GenericIPAddressField from mutating error messages.
Co-authored-by: Parth Verma <parth.verma@gmail.com>
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/ipv6.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/utils/ipv6.py b/django/utils/ipv6.py
index 88dd6ecb4b..8b691b5e66 100644
--- a/django/utils/ipv6.py
+++ b/django/utils/ipv6.py
@@ -26,7 +26,9 @@ def clean_ipv6_address(
try:
addr = ipaddress.IPv6Address(int(ipaddress.IPv6Address(ip_str)))
except ValueError:
- raise ValidationError(error_message, code="invalid")
+ raise ValidationError(
+ error_message, code="invalid", params={"protocol": _("IPv6")}
+ )
if unpack_ipv4 and addr.ipv4_mapped:
return str(addr.ipv4_mapped)