URLField form adds trailing slash to pathless URLs
|Reported by:||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
On line 678 in forms/fields.py, the URLfield.to_python() method adds a trailing slash to all pathless URLs (e.g. http://www.example.com becomes http://www.example.com/, but http://www.example.com/blah.html is left alone). The comment for why it does this is "the path portion may need to be added before query params", but I have no idea what that has to do with arbitrarily adding a slash to the end of pathless URLs.
Considering that this makes a visible change to the user's desired input, and they have no way to prevent it, I would like to see this changed. Simply removing the offending line (and the if check it's inside) seems to work just fine.