Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(rich_workspace): only add property for parent #5963

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cypress/e2e/propfind.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ describe('Text PROPFIND extension ', function() {
.should('have.property', richWorkspace, '')
})

// Android app relies on this when navigating nested folders
it('adds rich workspace property to nested folders', function() {
it('never adds rich workspace property to nested folders', function() {
cy.createFolder('/workspace')
// FIXME: Ideally we do not need a page context for those tests at all
// For now the dashboard avoids that we have failing requests due to conflicts when updating the file
Expand All @@ -52,9 +51,8 @@ describe('Text PROPFIND extension ', function() {
cy.uploadFile('test.md', 'text/markdown', '/workspace/Readme.md')
cy.propfindFolder('/', 1)
.then(results => results.pop().propStat[0].properties)
.should('have.property', richWorkspace, '## Hello world\n')
.should('not.have.property', richWorkspace)
})

})

describe('with workspaces disabled', function() {
Expand Down
7 changes: 6 additions & 1 deletion lib/DAV/WorkspacePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,19 @@ public function propFind(PropFind $propFind, INode $node) {
return;
}

// Only return the property for the parent node and ignore it for further in depth nodes
// Otherwise requesting parent with description files for all the children makes a huge performance impact for external storages children
if ($propFind->getDepth() !== $this->server->getHTTPDepth()) {
return;
}

$node = $node->getNode();
try {
$file = $this->workspaceService->getFile($node);
} catch (StorageNotAvailableException $e) {
$file = null;
}

// Only return the property for the parent node and ignore it for further in depth nodes
$propFind->handle(self::WORKSPACE_PROPERTY, function () use ($file) {
$cachedContent = '';
if ($file instanceof File) {
Expand Down
Loading