Skip to content

Commit

Permalink
fix: make storage dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
DD-Arras committed Dec 2, 2024
1 parent 2b89c1b commit 6c0e8bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Controller/Api/ValidationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ public function uploadDataset(Request $request)
$validation->setDatasetName($datasetName);

// Save file to storage
$fileLocation = 'validations/'.$validation->getDatasetName().'.zip';
if (! $this->dataStorage->directoryExists('upload')) {
$this->dataStorage->createDirectory('upload');
}
$fileLocation = 'upload/'.$validation->getDatasetName().'.zip';
if ($this->dataStorage->fileExists($fileLocation)){
$this->dataStorage->delete($fileLocation);
}
Expand Down
5 changes: 4 additions & 1 deletion src/Validation/ValidationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private function getZip(Validation $validation)

file_put_contents(
$zipPath,
$this->dataStorage->read('validations/' . $validation->getDatasetName() . '.zip')
$this->dataStorage->read('upload/' . $validation->getDatasetName() . '.zip')
);
}

Expand Down Expand Up @@ -321,6 +321,9 @@ private function saveToStorage(Validation $validation)
$validationDirectory = $this->storage->getDirectory($validation);
$normDataPath = $validationDirectory . '/validation/' . $validation->getDatasetName() . '.zip';

if (! $this->dataStorage->directoryExists($validationDirectory . 'validation')){
$this->dataStorage->createDirectory($validationDirectory . 'validation');
}
if ($this->dataStorage->fileExists($normDataPath)){
$this->dataStorage->delete($normDataPath);
}
Expand Down

0 comments on commit 6c0e8bd

Please sign in to comment.