nextcloud / nextcloud/server

[Bug]: Adding a public share to your Nextcloud does not work if no user is specified and the user is not logged in

Open
#44,825 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop 30-feedback bug feature: federation feature: sharing
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

In Nextcloud 28 and later right now this does not work because the federated file sharing plugin for the Files app is not compatible with the changes introduced in Nextcloud 28. But, even if it did, it is likely that the problem described below still happens :-)

In the public share page, if outgoing federated shares are enabled, the top right menu includes an Add to your Nextcloud item. When clicked an input field is shown, where it is expected that user@yourNextcloud.org is set. That sends a request to the sharer server to create a federated share with the remote server and user specified in the input.

However, in the dawn of time, only the remote server was expected to be set in the field. This legacy behaviour is still supported. In that case the page redirects to the Files app in the remote server with some special query fields, so once the Files app is loaded the sharer server is asked to create a federated share with the remote server and the now known user.

The problem is that, if the user was not already logged in when sending the Add to your Nextcloud form, before the Files app is opened the user will get redirected to index.php/login?redirect_url=/index.php/apps/files#remote={HOST}&token={SHARE_TOKEN}&owner..., and after logging in the part after the # will be lost and the user will be simply redirected to /index.php/apps/files without causing the addition of the public share. This is reproducible at least on Nextcloud 22.0.0; I did not check further back to find when the regression was introduced, though.

Steps to reproduce
  • Setup Nextcloud server A
  • Setup Nextcloud server B
  • In server A, create a public share
  • Ensure that no user is logged in server B in the current browser window
  • Open the link to the public share
  • In the top right menu, click on "Add to your Nextcloud"
  • Enter the address of server B (only the address, without user@)
  • In server B, log in as a user
  • Open the Files app

There is no dialog to add the remote share to your account

Expected behavior

There is a dialog to add the remote share to your account

Installation method

None

Nextcloud Server version

master

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

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

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/files_sharing/js/public.js and apps/federatedfilesharing/js/external.js, then trace the login redirect used before the Files app loads. Reproduce the server A/server B flow with the user logged out on server B; done means the remote-share dialog appears after login when only the server address was entered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
authentication, backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.