Allow licenses to be absent from netkans #4137
Merged
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.
Problem
If you omit the
license
from a netkan, you get alicense should match spec
error from the inflator, even if the mod is hosted on a server that provides license info in its API.Cause
Many years ago, netkan validation was much more primitive (see #346 (comment)). It did not inflate netkans into .ckan files, so all validation checks had to be performed with only the netkan available. A missing license in a netkan could mean a missing or invalid license in the ckan, which would make the client throw an exception. There was no way to catch that, so the field was made required, with a
x_netkan_license_ok
override for when the person reviewing the pull request had manually confirmed that the license on the server was valid.Since then, inflation was added to the validation, which allows validation to be performed on the .ckans as well, so it is no longer necessary to require the license in the netkan.
Changes
LicensesValidator
is moved fromNetkanValidator
toCkanValidator
. This will allow the license field to be omitted from netkans and filled in by the inflator. Any invalid licenses will still cause inflation errors, just later in the process.SpacedockTransformer
replaces spaces in licenses with-
, to make SD'sCC-BY-NC-SA 4.0
strings translate properly to ourCC-BY-NC-SA-4.0
.Fixes #4136.