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

Disable right click on shared file when hide download #29722

Closed
leviia opened this issue Nov 15, 2021 · 2 comments
Closed

Disable right click on shared file when hide download #29722

leviia opened this issue Nov 15, 2021 · 2 comments
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement feature: files

Comments

@leviia
Copy link

leviia commented Nov 15, 2021

Hello

It would be a great enhancement to prevent right click on shared file when "hide download" is on

It can be as simple as adding this js to the file apps/files_sharing/js/public.js

//prevent right-click when download is hidden
if (hideDownload === 'true') {
    document.addEventListener("contextmenu", function(e){
        e.preventDefault();
    }, false);
}

Or this code (using JQuery)

//prevent right-click when download is hidden
if (hideDownload === 'true') {
    $(document).on('contextmenu', function () {
        return false;
    });
}

I know the user is still able to bypass that but at least it is not that easy to download a file

I know also here we prevent the right click on the whole page (because of document), you can narrow it down to the exact div if you know which one).

At least it works

Has something like this a chance to be implemented in mainline ? So everyone will get this functionality.

All the best

Arnaud

@leviia leviia added 0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement labels Nov 15, 2021
@elhananjair
Copy link

@leviia that's awesome.
Can you mention this issue directly on right click app repo...

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Sep 17, 2024
@skjnldsv
Copy link
Member

Done for 31 nextcloud/viewer#2482

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement feature: files
Projects
None yet
Development

No branches or pull requests

4 participants