(string $raw)
| 2445 | } |
| 2446 | |
| 2447 | private static function normalizeShareSubPath(string $raw): array |
| 2448 | { |
| 2449 | $path = str_replace('\\', '/', trim((string)$raw)); |
| 2450 | $path = trim($path, "/ \t\n\r\0\x0B"); |
| 2451 | if ($path === '') { |
| 2452 | return ['', null]; |
| 2453 | } |
| 2454 | $parts = array_filter(explode('/', $path), fn($p) => $p !== ''); |
| 2455 | if (empty($parts)) { |
| 2456 | return ['', null]; |
| 2457 | } |
| 2458 | foreach ($parts as $seg) { |
| 2459 | if ($seg === '.' || $seg === '..') { |
| 2460 | return ['', "Invalid folder name."]; |
| 2461 | } |
| 2462 | if (!preg_match(REGEX_FOLDER_NAME, $seg)) { |
| 2463 | return ['', "Invalid folder name."]; |
| 2464 | } |
| 2465 | } |
| 2466 | return [implode('/', $parts), null]; |
| 2467 | } |
| 2468 | |
| 2469 | private static function splitShareFilePath(string $raw): array |
| 2470 | { |
no outgoing calls
no test coverage detected