Lasse Präsentationsmedien ohne Inhaltsfassung zu.
Bilder, Filme und Hörstücke lassen sich zuordnen und für die Website freigeben, ohne eine fachliche Fassung anzulegen. Unterrichtsfilme behalten die Teaserfassung an ihrer bereitgestellten Fassung. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
5590225f4f
commit
7b325f0d66
25 files changed
+734
-93
No files matched your search
@@ -44,7 +44,7 @@ public function refusal(ContentElement $element): ?string
|
||||
}
|
||||
|
||||
if ($this->derivedPath($element) === null) {
|
||||
return 'Für die Website fehlt eine freigebbare Ableitung. Beim Bild ist das das Vorschaubild, beim Film eine Teaserfassung unter teaser/. Die Originaldatei bleibt geschützt.';
|
||||
return 'Für die Website fehlt eine freigebbare Ableitung. Beim Bild ist das das Vorschaubild. Film und Hörstück ohne Inhaltsfassung nutzen die Datei am Medium unter teaser/. Ein Film mit Inhaltsfassung nutzt die Teaserfassung seiner bereitgestellten Fassung. Die Originaldatei bleibt geschützt.';
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -57,7 +57,18 @@ public function derivedPath(ContentElement $element): ?string
|
||||
}
|
||||
|
||||
if ($element->output_class === 'bild') {
|
||||
return $this->allowedDerivedPath($element->thumbnail_path, 'vorschau/');
|
||||
return $this->allowedDerivedPath($element->thumbnail_path, 'vorschau/', ['jpg', 'jpeg', 'png', 'webp', 'gif']);
|
||||
}
|
||||
|
||||
if (in_array($element->output_class, ['film', 'audio'], true)) {
|
||||
$extensions = $element->output_class === 'audio'
|
||||
? ['mp3', 'm4a', 'ogg']
|
||||
: ['mp4', 'webm'];
|
||||
$own = $this->allowedDerivedPath($element->preview_path, 'teaser/', $extensions);
|
||||
|
||||
if ($own !== null) {
|
||||
return $own;
|
||||
}
|
||||
}
|
||||
|
||||
if ($element->output_class !== 'film') {
|
||||
@@ -79,7 +90,7 @@ public function derivedPath(ContentElement $element): ?string
|
||||
->orderByDesc('id')
|
||||
->value('path');
|
||||
|
||||
return $this->allowedDerivedPath($path, 'teaser/');
|
||||
return $this->allowedDerivedPath($path, 'teaser/', ['mp4', 'webm']);
|
||||
}
|
||||
|
||||
public function publicPath(ContentElement $element, string $derivedPath): string
|
||||
@@ -100,7 +111,10 @@ private function isConfidential(ContentElement $element): bool
|
||||
return in_array($slug, PublicMaterialReader::CONFIDENTIAL_KINDS, true);
|
||||
}
|
||||
|
||||
private function allowedDerivedPath(mixed $path, string $prefix): ?string
|
||||
/**
|
||||
* @param list<string> $extensions
|
||||
*/
|
||||
private function allowedDerivedPath(mixed $path, string $prefix, array $extensions): ?string
|
||||
{
|
||||
if (! is_string($path) || ! str_starts_with($path, $prefix) || str_contains($path, '..')) {
|
||||
return null;
|
||||
@@ -108,7 +122,7 @@ private function allowedDerivedPath(mixed $path, string $prefix): ?string
|
||||
|
||||
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
|
||||
|
||||
if (! in_array($extension, ['jpg', 'jpeg', 'png', 'webp', 'gif', 'mp4', 'webm'], true)) {
|
||||
if (! in_array($extension, $extensions, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user