-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register "share-attributes" DAV property in public share pages
The viewer loads the default and registered DAV properties in the FileInfo object provided to the PDF viewer. The "share-attributes" property is needed to know if downloads are allowed, but it is not one of the properties included by default. The Files app registers it during its initialization, so it is automatically available when the PDF viewer is opened in the Files app. However, when the PDF viewer is opened in public share page nothing registers it, so it needs to be explicitly registered by the PDF viewer itself before the viewer is loaded. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
- Loading branch information
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
import { registerDavProperty } from '@nextcloud/files' | ||
|
||
import isPublicPage from './utils/isPublicPage.js' | ||
import isPdf from './utils/isPdf.js' | ||
import isSecureViewerAvailable from './utils/isSecureViewerAvailable.js' | ||
|
||
// The "share-attributes" DAV property needs to be explicitly registered so the | ||
// viewer returns it in the file info. This is implicitly done by the Files app, | ||
// so it does not need to be explicitly done by the PDF viewer when it is opened | ||
// in the Files app, only for public shares pages. | ||
if (isPublicPage() && isPdf() && !isSecureViewerAvailable()) { | ||
registerDavProperty('nc:share-attributes', { nc: 'http://nextcloud.org/ns' }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters