Option to Update URL Attribute with Missing Protocol #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've added an option, used like so:
This updates the attribute with the protocol, when missing. This way, all urls can be saved in a valid format suitable for linking. It makes sense to "normalize" urls into their linkable format before saving, rather than checking them every time when used.
There may be a concern about a validator actually updating an attribute. I'll admit, it feels a little odd. But it also seems like the cleanest way to handle the problem. I don't want to reject urls that are only missing the protocol, but I don't want to allow them into the database without a protocol, either.
ALSO
Running the specs generated a failure for ".no" TLD's. It seems that certain words like "no" and "off", when not used in quotes, have special meanings in YAML. This was fixed by putting all protocols and zones in quotes, within domain.yml.