nextcloud / text

📑 Collaborative document editing using Markdown
GNU Affero General Public License v3.0
550 stars 89 forks source link

[Bug]: clicking a hyperlink in a document opens in both the current tab and a new tab for users who can't edit the file #4395

Closed mig5 closed 2 months ago

mig5 commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

When a user opens a file (tested with markdown .md file, but possibly .odt as well) that's been shared with them, but which they don't have edit permissions for, and they left-click a hyperlink in that file, the link opens in both a new tab and the existing Nextcloud tab, simultaneously.

This does not occur if the user has 'edit' rights to the document. In this scenario, the link only opens in a new tab, as expected.

Steps to reproduce

  1. Create a markdown file and put a hyperlink in it (e.g a link to this Github issue)
  2. Share the file with another Nextcloud user, but don't give them edit rights to the file
  3. Left-click the link in the file as that other Nextcloud user - link opens in 2 tabs (one new tab, and the existing Nextcloud tab)
  4. Grant that Nextcloud user 'edit' rights to the file
  5. Open the file in Nextcloud again as that user and left-click the same link - link opens in just one new tab

Expected behavior

The link should only open in a new tab, regardless of edit or no-edit permission for that user

Installation method

Community Docker image

Nextcloud Server version

25

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

What user-backends are you using?

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpsecure": "ssl",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nextcloud.xxxxx.xxx"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.8.2",
        "overwrite.cli.url": "https:\/\/nextcloud.xxxxx.xxx",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "overwritehost": "nextcloud.xxxxx.xxx",
        "overwriteprotocol": "https",
        "loglevel": 2,
        "maintenance": false,
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": []
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - bruteforcesettings: 2.5.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - encryption: 2.13.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - integration_github: 1.0.15
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.1
  - password_policy: 1.15.0
  - photos: 2.0.1
  - polls: 5.0.5
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.4
  - richdocuments: 7.1.4
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - twofactor_totp: 7.0.0
  - twofactor_webauthn: 1.2.0
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - admin_audit
  - files_external
  - notify_push: 0.6.3
  - suspicious_login
  - user_ldap

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

No response

Additional info

No response

mig5 commented 1 year ago

Looks to be reported on the forum at https://help.nextcloud.com/t/links-in-text-files-will-open-2x/149729/9 - but I went ahead and reported it here since someone asked the OP there to file a Github issue (and not clear that they ever did)

mig5 commented 1 year ago

(thanks for transferring the issue to the right repository, my apologies). Now that it's in the 'text' repo, I searched the issue queue here and I found that https://github.com/nextcloud/text/issues/579#issuecomment-1281131398 is exactly the same issue/symptom described.

The only problem is, it's claimed to have been fixed there, around Oct 2022... but it's definitely a problem in the latest Nextcloud 25.0.8, so, perhaps it's a regression?

joshtrichards commented 9 months ago

The only problem is, it's claimed to have been fixed there, around Oct 2022... but it's definitely a problem in the latest Nextcloud 25.0.8, so, perhaps it's a regression?

3290 (the fix for #579) was only released for >=v26 from the looks of it.

joshtrichards commented 2 months ago

Closing since this is fixed in supported releases via #3290