only triger metadata preload logic when at least one metadata is requested

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/39860/head
Robin Appelman 2023-08-14 13:01:14 +07:00
parent fce1a164a0
commit 76acc3ada7
1 changed files with 10 additions and 6 deletions

@ -465,13 +465,17 @@ class FilesPlugin extends ServerPlugin {
$requestProperties = $propFind->getRequestedProperties();
if ($this->config->getSystemValueBool('enable_file_metadata', true) && $propFind->getDepth() === 1) {
$requestedMetaData = [];
foreach ($requestProperties as $requestProperty) {
if (isset(self::ALL_METADATA_PROPS[$requestProperty])) {
$requestedMetaData[] = self::ALL_METADATA_PROPS[$requestProperty];
}
$requestedMetaData = [];
foreach ($requestProperties as $requestProperty) {
if (isset(self::ALL_METADATA_PROPS[$requestProperty])) {
$requestedMetaData[] = self::ALL_METADATA_PROPS[$requestProperty];
}
}
if (
$this->config->getSystemValueBool('enable_file_metadata', true) &&
$propFind->getDepth() === 1 &&
$requestedMetaData
) {
$children = $node->getChildren();
// Preloading of the metadata