Skip to content

Conversation

@blizzz
Copy link
Member

@blizzz blizzz commented Nov 13, 2025

This is achieved by setting a specific DAV attribute. At the moment there is one handler in dav-apps FilesPlugin and it could overwrite the value with "false". We make sure not to downgrade here and prevent downgrade from dav (possible race condition).

Summary

TODO

  • remove code duplication by moving affected code into a SecureView service class.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

@blizzz blizzz added bug Something isn't working 2. developing Work in progress labels Nov 13, 2025
@github-project-automation github-project-automation bot moved this to 🧭 Planning evaluation (don't pick) in 📝 Office team Nov 13, 2025
@blizzz blizzz moved this from 🧭 Planning evaluation (don't pick) to 🏗️ In progress in 📝 Office team Nov 13, 2025
// FIXME: coordinate with Files how a better solution looks like. Maybe by setting it only to 'true' by any provider? To avoid overwriting. Or throwing a dedicated event in just this case?
$propFind->set(FilesPlugin::SHARE_HIDE_DOWNLOAD_PROPERTYNAME, 'true');
// avoid potential race condition with FilesPlugin that may set it to "false"
$propFind->handle(FilesPlugin::SHARE_HIDE_DOWNLOAD_PROPERTYNAME, 'true');
Copy link
Member Author

Choose a reason for hiding this comment

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

@susnux this works, but is uncomfortably hacky. Maybe sufficient for 32 and 31, but what do you think of making the dav app emit an event here and stay the whole owner of that attribute? Listeners can then mark a node download-hidden only.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not that sure because for the DAV part probably @salmart-dev or @CarlSchwan would be good to also include in the process.

Choose a reason for hiding this comment

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

@blizzz wasn't the set alone enough? The plugin in core is using handle, which should not override an already set value 🤔

The event solution sounds like a good idea if we need to make sure that the property is not purposefully or inadvertently set back to false and can live with more complex flow/code.

If it's a common case, another idea would be to add some code in Sabre/dav to "declare" a property as "irreversible" once a certain value has been set. So that any subsequent set or handle are not executed any longer. The requirement would be that whichever plugin owns the property has to be the first one setting it.

Another solution to make the above more generic would be to allow declaring a property with a callable parameter which checks if the value should be updatable/settable or not. This way one could implement more variants. I'm not sure which other use-cases we have though, so I'm not sure if this even makes sense, but would avoid the extra event, listener, handling complexity.

@blizzz blizzz force-pushed the fix/5170/hide-download-button-on-secure-view branch from 901762a to 2896f1e Compare November 14, 2025 23:35
@blizzz blizzz requested review from elzody and juliusknorr November 14, 2025 23:36
@blizzz blizzz force-pushed the fix/5170/hide-download-button-on-secure-view branch 2 times, most recently from 58974e7 to 3b27369 Compare November 21, 2025 23:19
This is achieved by setting a specific DAV attribute. At the moment there
is one handler in dav-apps FilesPlugin and it could overwrite the value
with "false". We make sure not to downgrade here and prevent downgrade
from dav (possible race condition).

Signed-off-by: Arthur Schiwon <[email protected]>
@blizzz blizzz force-pushed the fix/5170/hide-download-button-on-secure-view branch from 9a451c7 to b62b572 Compare November 24, 2025 21:05
@blizzz blizzz marked this pull request as ready for review November 24, 2025 21:05
@blizzz blizzz added 3. to review Ready to be reviewed and removed 2. developing Work in progress labels Nov 24, 2025
@blizzz
Copy link
Member Author

blizzz commented Nov 24, 2025

As discussed with @juliusknorr we'd take it like this (provided reviews are fine) and follow up later on with a better solution across NC. PR comes with tests :)

@blizzz
Copy link
Member Author

blizzz commented Nov 25, 2025

/backport to stable32

@blizzz
Copy link
Member Author

blizzz commented Nov 25, 2025

/backport to stable31

@blizzz blizzz moved this from 🏗️ In progress to 👀 In review in 📝 Office team Nov 25, 2025
@blizzz blizzz requested a review from emberfiend November 25, 2025 10:12
Copy link
Contributor

@elzody elzody left a comment

Choose a reason for hiding this comment

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

Seems to work fine as it is after some quick testing locally

@blizzz blizzz merged commit 84f003d into main Nov 25, 2025
76 of 81 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ☑️ Done in 📝 Office team Nov 25, 2025
@blizzz blizzz deleted the fix/5170/hide-download-button-on-secure-view branch November 25, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Ready to be reviewed bug Something isn't working

Projects

Status: ☑️ Done

Development

Successfully merging this pull request may close these issues.

better warning when trying to download a file that is restrictied via secure view

6 participants