X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/762d1d759590aa25466c3702279baff92c09e854..refs/pull/2023/head:/app/Uploads/AttachmentService.php diff --git a/app/Uploads/AttachmentService.php b/app/Uploads/AttachmentService.php index 6e875a1e7..ae4fb6e96 100644 --- a/app/Uploads/AttachmentService.php +++ b/app/Uploads/AttachmentService.php @@ -2,6 +2,7 @@ use BookStack\Exceptions\FileUploadException; use Exception; +use Illuminate\Support\Str; use Symfony\Component\HttpFoundation\File\UploadedFile; class AttachmentService extends UploadService @@ -185,9 +186,9 @@ class AttachmentService extends UploadService $storage = $this->getStorage(); $basePath = 'uploads/files/' . Date('Y-m-M') . '/'; - $uploadFileName = str_random(16) . '.' . $uploadedFile->getClientOriginalExtension(); + $uploadFileName = Str::random(16) . '.' . $uploadedFile->getClientOriginalExtension(); while ($storage->exists($basePath . $uploadFileName)) { - $uploadFileName = str_random(3) . $uploadFileName; + $uploadFileName = Str::random(3) . $uploadFileName; } $attachmentPath = $basePath . $uploadFileName;