#17751 closed Bug (fixed)
GenericIPAddressField allows an ipv6 address to start with a space
| Reported by: | Owned by: | Sasha Romijn | |
|---|---|---|---|
| Component: | Forms | Version: | dev |
| Severity: | Normal | Keywords: | GenericIPAddressField, ipv6 |
| Cc: | net147 | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
GenericIPAddressField allows an ipv6 address to start with a space, it should raise a ValidationError instead.
At least the IPAddressField (ipv4) does it.
Attachments (2)
Change History (14)
by , 14 years ago
| Attachment: | 17751-test.diff added |
|---|
comment:1 by , 14 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Uncategorized → Bug |
comment:2 by , 13 years ago
| Cc: | added |
|---|
follow-up: 4 comment:3 by , 13 years ago
why not just trimming the eventual initial white space? I could try fixing it even though I don't have experience with contributing back to django. Is there any page where it is described how to do so?
comment:4 by , 13 years ago
Replying to federico.capoano@…:
why not just trimming the eventual initial white space? I could try fixing it even though I don't have experience with contributing back to django. Is there any page where it is described how to do so?
This page can help you - https://docs.djangoproject.com/en/dev/internals/contributing/
comment:5 by , 13 years ago
| Has patch: | set |
|---|
comment:6 by , 13 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:7 by , 13 years ago
I strongly feel GenericIPAddressField should trim whitespace, and not raise a ValidationError. This is consistent with the behaviour of IntegerField, FloatField and EmailField, which also trim whitespace silently, and seems to be the nicest for usability. I see no risk for misinterpretation of the data when trimming.
The pull request in https://github.com/django/django/pull/757 will trim whitespace on both sides for all GenericIPAddressField instances (IPv4, IPv6 and generic).
For consistency, it also adds this feature to IPAddressField (they use the same validator anyways). This is backwards compatible.
comment:8 by , 13 years ago
| Patch needs improvement: | set |
|---|
I concur with Erik's reasoning.
Patch is good but I would leave in the actual correct test (without a space) and add a separate test for an IP address with a space.
comment:9 by , 13 years ago
| Patch needs improvement: | unset |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
| Version: | 1.4-beta-1 → master |
Agreed, new patch with that change: https://github.com/django/django/pull/759
comment:10 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Test showing issue