Skip to content

Commit ae6ff43

Browse files
committed
make path absolute for parent path handling
1 parent 6f7e633 commit ae6ff43

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Diff for: src/PHPCR/Shell/Console/Command/Phpcr/NodeListCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,13 @@ public function execute(InputInterface $input, OutputInterface $output): int
100100
if (!$globHelper->isGlobbed($session->getAbsPath($path))) {
101101
throw $e;
102102
}
103+
$path = $session->getAbsPath($path);
103104

104105
$parentPath = $this->get('helper.path')->getParentPath($path);
105106

106107
$filter = substr($path, strlen($parentPath));
107108

108-
if ($filter[0] == '/') {
109+
if ('/' === $filter[0]) {
109110
$filter = substr($filter, 1);
110111
}
111112

Diff for: src/PHPCR/Shell/Phpcr/PhpcrSession.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,12 @@ public function getAbsPath($path)
122122
return $this->getCwd();
123123
}
124124

125-
if (substr($path, 0, 1) == '/') {
125+
if (str_starts_with($path, '/')) {
126126
$absPath = $path;
127+
} elseif ('/' === $this->cwd) {
128+
$absPath = sprintf('/%s', $path);
127129
} else {
128-
if ($this->cwd == '/') {
129-
$absPath = sprintf('/%s', $path);
130-
} else {
131-
$absPath = sprintf('%s/%s', $this->getCwd(), $path);
132-
}
130+
$absPath = sprintf('%s/%s', $this->getCwd(), $path);
133131
}
134132

135133
return $absPath;

0 commit comments

Comments
 (0)