Opened 9 years ago
Last modified 9 years ago
#25593 closed Uncategorized
Remove scheme validation from URLValidator or provide all IANA acceptable schemes as defaults — at Initial Version
Reported by: | Marcin Nowak | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The problem
There are defined only four schemes as default: http,https,ftp,ftps.
But URL can have many many more valid schemes.
HTTP and FTP as good defaults are invalid - they are too limited.
There is no simple way to extend these schemes nor disable scheme validation.
We must extend URLField and redeclare default_validators
class property, which is too complex for that simple case.
Possible solutions
- disable scheme validation and enable it only when user defines
allowed_schemes
directly in URLField (backward incompatible) - provide
allowed_schemes
as an optional argument for URLFieldinit()
- provide all valid schemes as default set (based on https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml)
Preffered solution
Probide all (IANA) valid schemes as default together with possibility to change them by URLField init()
.