Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle nil values and empty arrays #198

Merged
merged 3 commits into from Dec 11, 2015
Merged

Handle nil values and empty arrays #198

merged 3 commits into from Dec 11, 2015

Conversation

oreoshake
Copy link
Contributor

We ran into an error where a nil value wouldn't pass the "arrays of strings" validation test. This came up when doing environment-specific configuration where values would be nil without compacting the array.

While testing this out, I also noticed that an empty array or array of nils ([nil] which is compacted) would include the directive, but without any value. script_src: [nil] would produce script-src ;. That's bad.

Also, I noticed that the code that minifies directives containing * was incorrectly discarding data: and blob: which are not covered by a * source.

Because configs can be environment-based and some values may not be configured for an environment, don't raise an exception during validation for nil values.
And because arrays are compacted, arrays of nils would have the same effect
* will not allow data: blob: etc
oreoshake added a commit that referenced this pull request Dec 11, 2015
Handle nil values and empty arrays
@oreoshake oreoshake merged commit f8b4ac2 into master Dec 11, 2015
@oreoshake oreoshake deleted the handle-nil-better branch December 11, 2015 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant