X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c429cf78187e80deb63982a282a1c6889f30291a..refs/pull/3008/head:/app/Uploads/ImageRepo.php diff --git a/app/Uploads/ImageRepo.php b/app/Uploads/ImageRepo.php index 115078561..c4205e357 100644 --- a/app/Uploads/ImageRepo.php +++ b/app/Uploads/ImageRepo.php @@ -16,6 +16,8 @@ class ImageRepo protected $restrictionService; protected $page; + protected static $supportedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp']; + /** * ImageRepo constructor. */ @@ -31,6 +33,14 @@ class ImageRepo $this->page = $page; } + /** + * Check if the given image extension is supported by BookStack. + */ + public function imageExtensionSupported(string $extension): bool + { + return in_array(trim($extension, '. \t\n\r\0\x0B'), static::$supportedExtensions); + } + /** * Get an image with the given id. */