Merge pull request #34994 from Glandos/fileinfo_perf

[Performance] Test valid path only if file info has to be retrieved
This commit is contained in:
Simon L 2022-11-11 17:11:21 +01:00 committed by GitHub
commit 9d45845d2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,10 +99,10 @@ class Node implements \OCP\Files\Node {
* @throws NotFoundException
*/
public function getFileInfo() {
if (!Filesystem::isValidPath($this->path)) {
throw new InvalidPathException();
}
if (!$this->fileInfo) {
if (!Filesystem::isValidPath($this->path)) {
throw new InvalidPathException();
}
$fileInfo = $this->view->getFileInfo($this->path);
if ($fileInfo instanceof FileInfo) {
$this->fileInfo = $fileInfo;