FIX: Composer upload icon regression because of HEIC

Now that HEIC conversion is enabled by default we need to update a few
file extension checks to include `heic` and heif` formats.

https://meta.discourse.org/t/-/144326/23?u=blake

bug reported here:

https://meta.discourse.org/t/-/161197?u=blake
This commit is contained in:
Blake Erickson 2020-08-17 19:34:37 -06:00
parent 38e7b1a049
commit ba9fbb3443
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ export default Controller.extend(ModalFunctionality, {
const imageUrl = this.imageUrl || "";
const toolbarEvent = this.toolbarEvent;
if (imageUrl.match(/\.(jpg|jpeg|png|gif)$/)) {
if (imageUrl.match(/\.(jpg|jpeg|png|gif|heic|heif)$/)) {
toolbarEvent.addText(`![](${imageUrl})`);
} else {
toolbarEvent.addText(imageUrl);

View File

@ -113,7 +113,7 @@ function validateUploadedFile(file, opts) {
return true;
}
const IMAGES_EXTENSIONS_REGEX = /(png|jpe?g|gif|svg|ico)/i;
const IMAGES_EXTENSIONS_REGEX = /(png|jpe?g|gif|svg|ico|heic|heif)/i;
function extensionsToArray(exts) {
return exts
@ -177,7 +177,7 @@ export function authorizedExtensions(staff, siteSettings) {
function authorizedImagesExtensions(staff, siteSettings) {
return authorizesAllExtensions(staff, siteSettings)
? "png, jpg, jpeg, gif, svg, ico"
? "png, jpg, jpeg, gif, svg, ico, heic, heif"
: imagesExtensions(staff, siteSettings).join(", ");
}