From 3bcce9e3c0208662bdcad8acc458d1f2d19f6f79 Mon Sep 17 00:00:00 2001 From: Leane Schlundt Date: Tue, 21 May 2024 08:31:32 +0200 Subject: [PATCH] Smaller changes --- src/Http/Requests/StoreStorageRequestFile.php | 3 ++- src/Jobs/DeleteStorageRequestFile.php | 4 ++-- src/resources/views/create.blade.php | 2 +- .../Http/Controllers/Api/StorageRequestFileControllerTest.php | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Http/Requests/StoreStorageRequestFile.php b/src/Http/Requests/StoreStorageRequestFile.php index d956b2c..3f10449 100644 --- a/src/Http/Requests/StoreStorageRequestFile.php +++ b/src/Http/Requests/StoreStorageRequestFile.php @@ -108,7 +108,7 @@ public function withValidator($validator) $shouldDeletePreviousChunks = false; if ($file->getSize() > $user->storage_quota_remaining) { - $validator->errors()->add('storage_exceeded', 'The file size exceeds the available storage quota.'); + $validator->errors()->add('file', 'The file size exceeds the available storage quota.'); $shouldDeletePreviousChunks = true; } @@ -170,6 +170,7 @@ public function withValidator($validator) $existsInOtherRequest = StorageRequestFile::join('storage_requests', 'storage_requests.id', '=', 'storage_request_files.storage_request_id') ->where('storage_requests.id', '!=', $this->storageRequest->id) ->where('storage_requests.user_id', $this->storageRequest->user_id) + // Don't use $path here, because it contains directory name ->where('storage_request_files.path','LIKE', '%'.$filename.'%') ->exists(); diff --git a/src/Jobs/DeleteStorageRequestFile.php b/src/Jobs/DeleteStorageRequestFile.php index 3358ef1..edc939f 100644 --- a/src/Jobs/DeleteStorageRequestFile.php +++ b/src/Jobs/DeleteStorageRequestFile.php @@ -77,7 +77,7 @@ public function handle() $file = StorageRequestFile::where('path','=',$this->path); // Do not delete files when delete-request is outdated - if($file->exists() && $this->retryCount != $file->first()->retry_count){ + if($file->exists() && $this->retryCount != $file->first()->retry_count) { return; } @@ -111,7 +111,7 @@ public function handle() } } - if($file->exists()){ + if($file->exists()) { $file->delete(); } } diff --git a/src/resources/views/create.blade.php b/src/resources/views/create.blade.php index a5ade27..1082859 100644 --- a/src/resources/views/create.blade.php +++ b/src/resources/views/create.blade.php @@ -131,7 +131,7 @@ class="btn btn-success"
-

Some file uploads failed.

+

Some file uploads failed