Skip to content

Commit

Permalink
Fix uploads without dropbox
Browse files Browse the repository at this point in the history
  • Loading branch information
zonky2 committed Sep 29, 2024
1 parent 882dac9 commit 2324966
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/Widgets/UploadOnSteroids.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ public function validate(): void
$this->uploadFolder = $newUploadFolder?->uuid ?? '';
}

$this->validateSingleUpload();
$this->validateMultipleUpload();
$this->deselectFile($inputName);
$this->deleteFile($inputName);
$this->validateSingleUpload();
$this->validateMultipleUpload();
}

/**
Expand All @@ -256,12 +256,9 @@ private function validateSingleUpload(): void

parent::validate();

if (!isset($_SESSION['FILES'][$inputName]) || $this->hasErrors()) {
return;
}
$file = $this->varValue;

$file = $_SESSION['FILES'][$inputName];
if (!isset($file['uuid'])) {
if ($this->hasErrors() || !\is_array($file) || !isset($file['uuid'])) {
return;
}

Expand Down Expand Up @@ -294,12 +291,9 @@ private function validateMultipleUpload(): void

parent::validate();

if (!isset($_SESSION['FILES'][$inputName]) || $this->hasErrors()) {
return;
}
$file = $this->varValue;

$file = $_SESSION['FILES'][$inputName];
if (!isset($file['uuid'])) {
if ($this->hasErrors() || !\is_array($file) || !isset($file['uuid'])) {
return;
}

Expand Down Expand Up @@ -353,7 +347,7 @@ private function deselectFile(string $inputName): void
if (
!$this->deselect
|| $this->hasErrors()
|| [] === ($post = (array) ($this->getCurrentRequest()?->request->get($inputName . '__reset') ?? []))
|| [] === ($post = (array) ($this->getCurrentRequest()?->request->all($inputName . '__reset') ?? []))
) {
return;
}
Expand Down Expand Up @@ -385,7 +379,7 @@ private function deleteFile(string $inputName): void
if (
!$this->delete
|| $this->hasErrors()
|| [] === ($post = (array) ($this->getCurrentRequest()?->request->get($inputName . '__delete') ?? []))
|| [] === ($post = (array) ($this->getCurrentRequest()?->request->all($inputName . '__delete') ?? []))
) {
return;
}
Expand Down

0 comments on commit 2324966

Please sign in to comment.