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

Method normalizeShareSubPath

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

Source from the content-addressed store, hash-verified

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 {

Callers 3

splitShareFilePathMethod · 0.95
uploadToSharedFolderMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected