From afba80692d0ed74d5e99123d405feda11b4c9a2f Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 12 Oct 2022 09:45:34 +0200 Subject: [PATCH] wait #5523 @0.25 --- app/Services/WorkshopV2.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Services/WorkshopV2.php b/app/Services/WorkshopV2.php index 46ed55d09..714c1c062 100644 --- a/app/Services/WorkshopV2.php +++ b/app/Services/WorkshopV2.php @@ -4,6 +4,7 @@ namespace App\Services; use App\Models\User; use Cubist\Util\Files\Files; +use Cubist\Util\Str; use Cubist\Util\Zip; use Exception; use GuzzleHttp\Client; @@ -30,7 +31,12 @@ class WorkshopV2 public function __construct($user) { $this->user = $user; - $this->_cookies = new FileCookieJar(Files::mkdir(protected_path('ws2cookies/')) . $this->user->id, true); + if (null !== $this->user) { + $cookie_id = $this->user->id; + } else { + $cookie_id = Str::random(5); + } + $this->_cookies = new FileCookieJar(Files::mkdir(protected_path('ws2cookies/')) . $cookie_id, true); $this->_http = new Client(['base_uri' => $this->_domain, 'timeout' => 60000, 'read_timeout' => 60000, 'cookies' => $this->_cookies]); } -- 2.39.5