richdocuments icon indicating copy to clipboard operation
richdocuments copied to clipboard

Can't copy text from shared office files after Update to 6.2.1

Open jr-timme opened this issue 3 years ago • 4 comments

Describe the bug After updating from 6.2.0 to 6.2.1 a user cannot copy text from a shared office document (odt, ods, ...) any more.

To Reproduce Steps to reproduce the behavior:

  1. Install or Update Nextcloud Office >=6.2.1
  2. Share a directory with another user
  3. Create a office document, e.g. a ods file inside the shared directory and input some text
  4. switch accounts to the second user
  5. open the document from the shared directory
  6. copy the previously entered text

Expected behavior The clipboard should contain the text from the document

Actual behavior The clipboard contains:

Stub HTML Message
    
    
  
  
    Copying from the document disabled

Client details:

  • OS: Linux
  • Browser newest Firefox or Chromium
  • Device: Desktop

Server details

Operating system: Debian 10

Web server: NGINX 1.21.6

Database: MariaDB 10.3

PHP version: 8.1

Nextcloud version: 24.0.6

Version of the richdocuments app 6.2.1

Version of Collabora Online 22.05-15

Related Issues

There is another issue over in the server repository: https://github.com/nextcloud/server/issues/34282 This seems to be the same problem, but probably got opened in the wrong repository

jr-timme avatar Oct 11 '22 09:10 jr-timme

I stumbled upon the same issue today (Nextcloud 24.0.6 - Windows 10 - Google Chrome latest version). Only the user who created the shared directory can copy and paste the data contained in its files.

pbst7 avatar Oct 11 '22 14:10 pbst7

Haven't reproduced or tested yet but from a quick look at the code it seems like this patch could fix this:

diff --git a/lib/TokenManager.php b/lib/TokenManager.php
index 8693daf1..9cb0bda1 100644
--- a/lib/TokenManager.php
+++ b/lib/TokenManager.php
@@ -166,7 +166,7 @@ class TokenManager {
                                                /** @var SharedStorage $storage */
                                                $share = $storage->getShare();
                                                $attributes = $share->getAttributes();
-                                               if ($attributes !== null && !$attributes->getAttribute('permissions', 'download')) {
+                                               if ($attributes !== null && $attributes->getAttribute('permissions', 'download') === false) {
                                                        $hideDownload = true;
                                                        break;
                                                }

juliusknorr avatar Oct 11 '22 15:10 juliusknorr

The proposed change fixes it on my side :+1:

jr-timme avatar Oct 11 '22 15:10 jr-timme

The proposed solution fixed it for me too

pbst7 avatar Oct 12 '22 07:10 pbst7

Thanks for testing everyone, pull request is at https://github.com/nextcloud/richdocuments/pull/2511

juliusknorr avatar Oct 14 '22 17:10 juliusknorr