]> BookStack Code Mirror - bookstack/blobdiff - app/Exports/ZipExports/Models/ZipExportImage.php
ZIP Imports: Added image type validation/handling
[bookstack] / app / Exports / ZipExports / Models / ZipExportImage.php
index 89083b15be116bbe1e97e2833559131265177cc6..e0e7d11986d82c58324e95845ad47a1bde4095e3 100644 (file)
@@ -32,10 +32,11 @@ class ZipExportImage extends ZipExportModel
 
     public static function validate(ZipValidationHelper $context, array $data): array
     {
+        $acceptedImageTypes = ['image/png', 'image/jpeg', 'image/gif', 'image/webp'];
         $rules = [
             'id'    => ['nullable', 'int', $context->uniqueIdRule('image')],
             'name'  => ['required', 'string', 'min:1'],
-            'file'  => ['required', 'string', $context->fileReferenceRule()],
+            'file'  => ['required', 'string', $context->fileReferenceRule($acceptedImageTypes)],
             'type'  => ['required', 'string', Rule::in(['gallery', 'drawio'])],
         ];