]> BookStack Code Mirror - bookstack/blobdiff - app/Exports/ZipExports/ZipExportValidator.php
ZIP Imports: Added parent and permission check pre-import
[bookstack] / app / Exports / ZipExports / ZipExportValidator.php
index e27ae53c774348d09d2654b17c63334c0341035f..889804f201390970a5ddd1a01eb8313b9e670358 100644 (file)
@@ -10,20 +10,19 @@ use BookStack\Exports\ZipExports\Models\ZipExportPage;
 class ZipExportValidator
 {
     public function __construct(
-        protected string $zipPath,
+        protected ZipExportReader $reader,
     ) {
     }
 
     public function validate(): array
     {
-        $reader = new ZipExportReader($this->zipPath);
         try {
-            $importData = $reader->readData();
+            $importData = $this->reader->readData();
         } catch (ZipExportException $exception) {
             return ['format' => $exception->getMessage()];
         }
 
-        $helper = new ZipValidationHelper($reader);
+        $helper = new ZipValidationHelper($this->reader);
 
         if (isset($importData['book'])) {
             $modelErrors = ZipExportBook::validate($helper, $importData['book']);