Comment 1 for bug 1499062

Revision history for this message
Jeffrey C Jones (trapnine) wrote : Re: Internal Server Error if 'Sync URL' Setting has a preceding whitespace

BootSourceSettings Model uses URLField and BootSourceSettingsForm does not (it uses CharField, which can be any string). So the form doesn't strip() nor does it check for URL formatting, then it tries to save() it into the Model and boom.

As an aside: I've noticed our Forms don't use any 'stripping' CharField (the default CharField doesn't do it for obvious reasons). Many of our string form fields SHOULD strip surrounding whitespace, since many of them are file paths, names, etc. Non-stripped whitespace could cause lots of problems, and even if it is user error, we should use the forms to clean these inputs up.

I've created and employed one for the other field on this Form (boot_source_keyring, since it's a file path and shouldn't start or end with spaces).