From: Vincent Vanwaelscappel Date: Wed, 12 Oct 2022 07:45:34 +0000 (+0200) Subject: wait #5523 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=afba80692d0ed74d5e99123d405feda11b4c9a2f;p=fluidbook-toolbox.git wait #5523 @0.25 --- 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]); }