Skip to content

Commit

Permalink
Merge pull request #3889 from nextcloud/backport/3872/stable29
Browse files Browse the repository at this point in the history
[stable29] fix: Show PDF even when download hidden on public share
  • Loading branch information
elzody committed Aug 7, 2024
2 parents dc9a532 + 78d4198 commit ec42dbc
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 369 deletions.
1 change: 0 additions & 1 deletion lib/Listener/ShareLinkListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function handle(Event $event): void {
$this->initialStateService->prepareParams(['userId' => $loggedInUser]);
$this->initialStateService->provideCapabilities();

Util::addScript('richdocuments', 'richdocuments-files');
Util::addScript('richdocuments', 'richdocuments-viewer', 'viewer');
Util::addScript('richdocuments', 'richdocuments-public', 'viewer');
}
Expand Down
357 changes: 0 additions & 357 deletions src/files.js

This file was deleted.

5 changes: 5 additions & 0 deletions src/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,8 @@ export {
splitPath,
getRandomId,
}

export { default as isDocument } from './isDocument.js'
export { default as isPdf } from './isPdf.js'
export { default as isPublic } from './isPublicPage.js'
export { default as isDownloadHidden } from './isDownloadHidden.js'
16 changes: 16 additions & 0 deletions src/helpers/isDownloadHidden.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
/**
* Determines if the resource is downloadable
* @return {boolean}
*/
function isDownloadHidden() {
/** @type HTMLInputElement */
const downloadHiddenElement = document.getElementById('hideDownload')

return Boolean(downloadHiddenElement) && downloadHiddenElement.value === 'true'
}

export default isDownloadHidden
Loading

0 comments on commit ec42dbc

Please sign in to comment.