- Fix: Notifiable-Trait zum User-Model hinzugefuegt (behebt notify()-500er) - Installer: SMTP-Verbindungstest mit EsmtpTransport + Ueberspringen-Link - Admin: Neuer E-Mail-Tab mit SMTP-Konfiguration + Verbindungstest - Admin: Lazy Quill-Initialisierung (nur sichtbare Locale wird geladen) - Uebersetzungen: 17 neue Mail-Keys in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.1 KiB
PHP
Executable File
50 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace League\Flysystem;
|
|
|
|
class WhitespacePathNormalizer implements PathNormalizer
|
|
{
|
|
public function normalizePath(string $path): string
|
|
{
|
|
$path = str_replace('\\', '/', $path);
|
|
$this->rejectFunkyWhiteSpace($path);
|
|
|
|
return $this->normalizeRelativePath($path);
|
|
}
|
|
|
|
private function rejectFunkyWhiteSpace(string $path): void
|
|
{
|
|
if (preg_match('#\p{C}+#u', $path)) {
|
|
throw CorruptedPathDetected::forPath($path);
|
|
}
|
|
}
|
|
|
|
private function normalizeRelativePath(string $path): string
|
|
{
|
|
$parts = [];
|
|
|
|
foreach (explode('/', $path) as $part) {
|
|
switch ($part) {
|
|
case '':
|
|
case '.':
|
|
break;
|
|
|
|
case '..':
|
|
if (empty($parts)) {
|
|
throw PathTraversalDetected::forPath($path);
|
|
}
|
|
array_pop($parts);
|
|
break;
|
|
|
|
default:
|
|
$parts[] = $part;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return implode('/', $parts);
|
|
}
|
|
}
|