MCPcopy Create free account
hub / github.com/error311/FileRise / splitShareFilePath

Method splitShareFilePath

src/FileRise/Domain/FolderModel.php:2469–2493  ·  view source on GitHub ↗
(string $raw)

Source from the content-addressed store, hash-verified

2467 }
2468
2469 private static function splitShareFilePath(string $raw): array
2470 {
2471 $path = str_replace('\\', '/', trim((string)$raw));
2472 $path = trim($path, "/ \t\n\r\0\x0B");
2473 if ($path === '') {
2474 return ['', '', "Missing file name."];
2475 }
2476 $parts = array_filter(explode('/', $path), fn($p) => $p !== '');
2477 if (empty($parts)) {
2478 return ['', '', "Missing file name."];
2479 }
2480 $file = array_pop($parts);
2481 if ($file === '' || !preg_match(REGEX_FILE_NAME, $file)) {
2482 return ['', '', "Invalid file name."];
2483 }
2484 $folder = '';
2485 if (!empty($parts)) {
2486 [$normalized, $err] = self::normalizeShareSubPath(implode('/', $parts));
2487 if ($err) {
2488 return ['', '', $err];
2489 }
2490 $folder = $normalized;
2491 }
2492 return [$folder, $file, null];
2493 }
2494
2495 private static function buildSharedFolderKey(string $shareRootKey, string $subPath): string
2496 {

Callers 1

getSharedFileInfoMethod · 0.95

Calls 1

normalizeShareSubPathMethod · 0.95

Tested by

no test coverage detected