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

Fix/dav #2608

Merged
merged 6 commits into from
Jul 6, 2022
Merged

Fix/dav #2608

merged 6 commits into from
Jul 6, 2022

Conversation

CarlSchwan
Copy link
Member

Summary

Clients expects this behavior:
If rich-workspaces is enabled and readme.md is empty or does not exist, it must return "".
If disabled -> null.
If readme.md has content -> show content

This revert to it and also make it possible in a separate commit to not have to add 'Depth: 1' in the curl request to get the workspace information

@tobiasKaminsky
Copy link
Member

@max-nextcloud can we then also have a test, so this regression cannot happen again? :)

@CarlSchwan
Copy link
Member Author

@vinicius73 why was master merged in this branch?

@vinicius73
Copy link
Member

@vinicius73 why was master merged in this branch?

This branch has master as target, we can't merge it properly without update it.
Last commits in master update some dependencies, it can affect tests.

@CarlSchwan
Copy link
Member Author

we should do rebasing instead then instead of creating merge commits, always a bit cleaner

@tobiasKaminsky
Copy link
Member

👍 "add folder info" works again.
(though i now cannot use text within Android app, but either this is a problem on my side or a different bug)

@tobiasKaminsky
Copy link
Member

One problem I now see is:

  • have folder 1, inside subfolder 2
  • go into folder 1, retrieve content of it: subfolder 2 does not show rich workspaces
  • go into folder 2, see that it has content -> is updated and shown in Android
  • go back to folder 1, refresh -> subfolder 2 has no content thus it is deleted

--> if requested, the folder and its children should always have the rich workspace property properly set

@max-nextcloud
Copy link
Collaborator

max-nextcloud commented Jun 22, 2022

The CI failures are indicating that names other than 'Readme.md' - i.e. 'README.md' or 'Anleitung.md' do not work anymore for the rich workspaces in the web ui.

This used to be server side logic in the /workspace text endpoint. We stopped using that endpoint and rely purely on PROPFIND results since NC 24 to speed up rendering of rich workspaces in the files view.

I'm not a big fan of supporting translated or all caps readme file names - but it's what we did in the past so breaking it does not seem like a good idea either.

@max-nextcloud
Copy link
Collaborator

also make it possible in a separate commit to not have to add 'Depth: 1' in the curl request to get the workspace information

@CarlSchwan Sounds like you've been using curl to test this... Could you share your curl commands so i can base the tests on it?

@max-nextcloud max-nextcloud force-pushed the fix/dav branch 3 times, most recently from 02da266 to 35bc87d Compare June 22, 2022 12:20
@max-nextcloud
Copy link
Collaborator

Added tests and fixed issues that the reverted commit had fixed.

The workspace property is still not set for nested folders (see #2608 (comment)). I think in order to bring that back we need to revert be562a4.

@max-nextcloud max-nextcloud force-pushed the fix/dav branch 2 times, most recently from 21f21f4 to 1bbef41 Compare June 22, 2022 12:57
@CarlSchwan
Copy link
Member Author

curl 'http://nextcloud.local/remote.php/dav/files/admin/' -v -X PROPFIND -u admin:admin --data '<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns">
  <d:prop>
    <d:getlastmodified />
    <d:getetag />
    <d:resourcetype />
    <oc:fileid />
    <nc:file-metadata-size /><oc:permissions />
    <oc:size />
    <d:getcontentlength />
    <d:quota-available-bytes />
    <nc:rich-workspace /> <nc:rich-workspace-file /> <nc:has-preview />
    <nc:mount-type />
    <nc:is-encrypted />
    <ocs:share-permissions />
    <oc:tags />
    <oc:favorite />
    <oc:owner-id />
    <oc:owner-display-name />
    <oc:share-types />
    <oc:comments-unread />
  </d:prop>
</d:propfind>' | xmllint --format -

@max-nextcloud max-nextcloud force-pushed the fix/dav branch 2 times, most recently from 2a369ea to c24534a Compare June 22, 2022 13:26
@max-nextcloud
Copy link
Collaborator

@tobiasKaminsky I think this should fix both issues now. Also added regression tests

if ($propFind->getDepth() === $this->server->getHTTPDepth()) {
$propFind->handle(self::WORKSPACE_PROPERTY, function () use ($node) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure about removing this condition. #2608 (comment) sounds like workspace needs to be set for nested folders and we rely on it being set in our new tests for depth=0.

My understanding is that this will only be evaluated anyway if the property is requested. Would like to hear @juliushaertl opinion on this before a merge though.

@tobiasKaminsky
Copy link
Member

@tobiasKaminsky I think this should fix both issues now. Also added regression tests

Looks good 👍👍👍

@tobiasKaminsky
Copy link
Member

I found a strange bug?
On Android:

  • create subfolder 1
  • go into it
  • add folder content / rich workspaces

Use Insomnia/cURL to show rich-workspaces property of /1/ folder -> see nothing
Force refresh folder in Android -> still nothings
Go to web in /1/ folder, see rich workspaces -> then it is also in Insomnia / Android

@szaimen
Copy link
Contributor

szaimen commented Jul 4, 2022

What is missing here?

@max-nextcloud
Copy link
Collaborator

max-nextcloud commented Jul 4, 2022

This PR reverts a change that was introduces as a performance fix. We need to evaluate the impact of undoing that fix.

(See #2608 (review) for the code in question)

@szaimen
Copy link
Contributor

szaimen commented Jul 4, 2022

This PR reverts a change that was introduces as a performance fix. We need to evaluate the impact of undoing that fix.

👍 I hope this will be possible before the first RC of 24.0.3...

@max-nextcloud
Copy link
Collaborator

max-nextcloud commented Jul 5, 2022

So i profiled this some.

Profiling Command
for n in {1..10} ; do curl -w "%{time_total}\n" -o /dev/null -s 'http://nextcloud.local/remote.php/dav/files/admin/' -X PROPFIND -u admin:admin --data '<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns">
  <d:prop>
    <d:getlastmodified />
    <d:getetag />
    <d:resourcetype />
    <oc:fileid />
    <nc:file-metadata-size /><oc:permissions />
    <oc:size />
    <d:getcontentlength />
    <d:quota-available-bytes />
    <nc:rich-workspace /> <nc:rich-workspace-file /> <nc:has-preview />
    <nc:mount-type />
    <nc:is-encrypted />
    <ocs:share-permissions />
    <oc:tags />
    <oc:favorite />
    <oc:owner-id />
    <oc:owner-display-name />
    <oc:share-types />
    <oc:comments-unread />
  </d:prop>
</d:propfind>'; done | LC_ALL=C awk '{ total += $1; count++ } END { print total/count }'

22 Folders inside root folder of admin:

  • fix/dav: 0.542629
  • master: 0.414488

222 Folders inside root folder of admin:

  • fix/dav: 2.3157
  • master: 0.763323
  • fix/dav (Readme.md only): 1.5852

@juliusknorr
Copy link
Member

@tobiasKaminsky Can you maybe clarify on how the android client is requesting the workspaces especially in regards to the Depth value? From #994 we had issues in the past with large folder structures that is why the response was limited to only return the workspace on the requested root node.

@tobiasKaminsky
Copy link
Member

@juliushaertl initial bug fix works, what we discussed yesterday!
Also works on iOS.

But this one still happens:

I found a strange bug? On Android:

* create subfolder 1

* go into it

* add folder content / rich workspaces

Use Insomnia/cURL to show rich-workspaces property of /1/ folder -> see nothing Force refresh folder in Android -> still nothings Go to web in /1/ folder, see rich workspaces -> then it is also in Insomnia / Android

@juliusknorr
Copy link
Member

But this one still happens:

@tobiasKaminsky I could reproduce but seems related to the files_lock app. Do you have that one enabled in your test instance? I'd consider that a separate bug then.

@tobiasKaminsky
Copy link
Member

@tobiasKaminsky I could reproduce but seems related to the files_lock app. Do you have that one enabled in your test instance? I'd consider that a separate bug then.

I have, yes.
Disabling "fixes" it.
Shall I create a new bug in files_lock, or will you directly create a fix 🤡?

@max-nextcloud max-nextcloud self-requested a review July 6, 2022 08:49
@juliusknorr
Copy link
Member

Shall I create a new bug in files_lock, or will you directly create a fix 🤡?

Should be fixed on master already with nextcloud/files_lock#75 but I have a follow up patch in the pipeline that I worked on with @max-nextcloud now.

CarlSchwan and others added 6 commits July 6, 2022 10:51
Otherwise if the Depth header is ommited, the workspace information
won't be display at all.

Signed-off-by: Carl Schwan <[email protected]>
These fixes were lost when reverting 3e40b7b.

Signed-off-by: Max <[email protected]>
@max-nextcloud
Copy link
Collaborator

I profiled this and it actually improves performance. With 222 folders i get:

  • now: 1.72988
  • before: 2.3157

This is still fairly slow and also applies when loading the files list in the browser. On the other hand this is the expected behavior by the client. We will either need to add some caching or make more specific requests on the client (one depth 0 PROPFIND with rich-workspace property and a depth 1 PROPFIND without.

I approved this and will merge as it fixes the bug in question.

@max-nextcloud
Copy link
Collaborator

/backport to stable24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: PROPFIND on dav returns null instead of 404
6 participants