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

Method isSafeSegment

src/FileRise/Domain/FolderModel.php:593–609  ·  view source on GitHub ↗

Helpers (private) */

(string $name)

Source from the content-addressed store, hash-verified

591
592 /* Helpers (private) */
593 private static function isSafeSegment(string $name): bool
594 {
595 if ($name === '.' || $name === '..') {
596 return false;
597 }
598 if (strpos($name, '/') !== false || strpos($name, '\\') !== false) {
599 return false;
600 }
601 if (strpos($name, "\0") !== false) {
602 return false;
603 }
604 if (preg_match('/[\x00-\x1F]/u', $name)) {
605 return false;
606 }
607 $len = mb_strlen($name);
608 return $len > 0 && $len <= 255;
609 }
610
611 private static function isValidFolderSegment(string $name): bool
612 {

Callers 13

countVisibleMethod · 0.95
countVisibleDeepMethod · 0.95
isValidFolderSegmentMethod · 0.95
buildSnapshotMethod · 0.45
countVisibleRemoteMethod · 0.45
listChildrenMethod · 0.45
listChildrenRemoteMethod · 0.45
scanFolderTreeForCopyMethod · 0.45
getFolderListRemoteMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected