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.
closes #1769
This PR:
fixes inability to upload .jpg images due to a change in
web_image_content_types
that we used to rely on;removes the check for "submitted extension" completely as we already check the actual type of the file and don't need the submitted extension for anything (not to mention that extension checking is brittle and should be avoided in the first place. Case in point - the issue at hand);
adds a new
options
column (YAML array encoded) for site settings, as well as a matchingarray
type;a new global site setting in the "Site Details" category -
AllowedUploadTypes
that allows admins to choose allowed file types (important note: to avoid scope creep & unforeseen consequences, the setting can only be restricted for now but can easily be extended later):I did not bother with human-friendly labels at this point as changing the setting itself requires expertise, and adding them in our current setup is a bit burdensome, but if anyone thinks it'll be beneficial to do so now, happy to oblige. The setting's description could also use some work - suggestions welcome (quesiton for @ArtOfCode-: do we have any reverse proxy or AWS settings / policies that admins need to be made aware of when editing the setting?).
Note for reviewers: there's both a new seed and a new migration. Don't forget to run & rollback both when switching between branches. There's also a new gem (
mime-types
), so remember to install it first.