diff --git a/Dockerfile b/Dockerfile index 88de52858b..bd363ccd18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -105,7 +105,7 @@ RUN \ && ln -fs "/var/lib/snipeit/keys/ldap_client_tls.cert" "/var/www/html/storage/ldap_client_tls.cert" \ && ln -fs "/var/lib/snipeit/keys/ldap_client_tls.key" "/var/www/html/storage/ldap_client_tls.key" \ && chown docker "/var/lib/snipeit/keys/" \ - && chown -h docker "/var/www/html/storage/" \ + && chown -Rh docker "/var/www/html/storage/" \ && chmod +x /var/www/html/artisan \ && echo "Finished setting up application in /var/www/html" diff --git a/app/Http/Controllers/Users/UserFilesController.php b/app/Http/Controllers/Users/UserFilesController.php index 87213f2498..ded44f35f6 100644 --- a/app/Http/Controllers/Users/UserFilesController.php +++ b/app/Http/Controllers/Users/UserFilesController.php @@ -78,24 +78,28 @@ class UserFilesController extends Controller */ public function destroy($userId = null, $fileId = null) { - $user = User::find($userId); - $destinationPath = config('app.private_uploads').'/users'; + if ($user = User::find($userId)) { + + $this->authorize('delete', $user); + $rel_path = 'private_uploads/users'; + + + if ($log = Actionlog::find($fileId)) { + $filename = $log->filename; + $log->delete(); + + if (Storage::exists($rel_path.'/'.$filename)) { + Storage::delete($rel_path.'/'.$filename); + return redirect()->back()->with('success', trans('admin/users/message.deletefile.success')); + } - if (isset($user->id)) { - $this->authorize('update', $user); - $log = Actionlog::find($fileId); - $full_filename = $destinationPath.'/'.$log->filename; - if (file_exists($full_filename)) { - unlink($destinationPath.'/'.$log->filename); } - $log->delete(); + // The log record doesn't exist somehow return redirect()->back()->with('success', trans('admin/users/message.deletefile.success')); } - // Prepare the error message - $error = trans('admin/users/message.user_not_found', ['id' => $userId]); - // Redirect to the licence management page - return redirect()->route('users.index')->with('error', $error); + + return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', ['id' => $userId])); } diff --git a/config/version.php b/config/version.php index a1d4695f7f..7d76ae0477 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v6.4.1', - 'full_app_version' => 'v6.4.1 - build 13458-gf2cc9ec1dd', - 'build_version' => '13458', + 'app_version' => 'v6.4.2', + 'full_app_version' => 'v6.4.2 - build 13487-gb489c71fa2', + 'build_version' => '13487', 'prerelease_version' => '', - 'hash_version' => 'gf2cc9ec1dd', - 'full_hash' => 'v6.4.1-68-gf2cc9ec1dd', + 'hash_version' => 'gb489c71fa2', + 'full_hash' => 'v6.4.2-97-gb489c71fa2', 'branch' => 'master', ); \ No newline at end of file