incomingIsReadable($incomingPath)) { throw new DomainRuleException('Die Bilddatei liegt nicht im Eingang.'); } $element = app(ContentService::class)->createElement('bild', 'bild', $title); app(IdentityProfile::class)->fill($element, [ 'display_title' => $title, 'website_credit' => $credit, 'website_alt' => $alt, ], $actor); AcceptWebsiteImage::dispatch($element->id, $incomingPath, $actor?->id); return $element->fresh(); } private function incomingIsReadable(string $path): bool { return (str_starts_with($path, 'cms/') || str_starts_with($path, 'vorschau/')) && ! str_contains($path, '..') && preg_match('#^(cms|vorschau)/[A-Za-z0-9._\-/]+$#', $path) === 1 && Storage::disk('cms_incoming')->exists($path); } }