nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.19k stars 4.04k forks source link

[Bug]: Clicking "Save share" button gives no feedback resulting in error (public email shares) #45436

Open dorianne-arawa opened 5 months ago

dorianne-arawa commented 5 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

On instances with Nexcloud versions 27.1.7 and 27.1.9, public email share links display an error when created, whereas they are in fact created (and displayed on page reload only).

Full error message : Error creating the share failed, because this item is already shared with user

On the first click to confirm the share, the request is sent, but the front end displays nothing. The user clicks a second time and receives an error (but the share was created on the first click).

Steps to reproduce

  1. go to a folder and open its Sharing parameters
  2. enter an external e-mail address (not existing on the instance) in the first Search for share recipients field
  3. click on the desired e-mail address (make sure you have the e-mail icon at the end of the line)
  4. click once on Save share : nothing happens in the user interface
  5. click on Save share a second time: the error message appears (Error creating the share <file name> failed, because this item is already shared with user <email address>)
  6. reload the page: the e-mail link has now been created

Expected behavior

  1. go to a folder and open its Sharing parameters
  2. enter an external e-mail address (not existing on the instance) in the first Search for share recipients field
  3. click on the desired e-mail address (make sure you have the e-mail icon at the end of the line)
  4. click once on Save share : the share is created, without error message

Installation method

Community Manual installation with Archive

Nextcloud Server version

27

Operating system

RHEL/CentOS

PHP engine version

PHP 8.1

Web server

Nginx

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 Disabled

What user-backends are you using?

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

./nextcloud.log:{"reqId":"2tiqC3NkXfRYeoJPlt8X","level":0,"time":"2024-05-22T12:11:01+02:00","remoteAddr":"37.171.179.29","user":"user","app":"Federated File Sharing","method":"POST","url":"/ocs/v2.php/apps/files_sharing/api/v1/shares","message":"Sharing Talk failed, because this item is already shared with user test@example\.fr","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0","version":"27.1.9.1","data":{"app":"Federated File Sharing"}}
./nextcloud.log:{"reqId":"2tiqC3NkXfRYeoJPlt8X","level":3,"time":"2024-05-22T12:11:01+02:00","remoteAddr":"37.171.179.29","user":"user","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files_sharing/api/v1/shares","message":"Exception thrown: Exception","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0","version":"27.1.9.1","exception":{"Exception":"Exception","Message":"Le partage de Talk a \u00e9chou\u00e9, parce que cet \u00e9l\u00e9ment est d\u00e9j\u00e0 partag\u00e9 avec l'utilisateur test@example\.fr","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/lib/private/Share20/Manager.php","line":828,"function":"create","class":"OCA\\ShareByMail\\ShareByMailProvider","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/apps/files_sharing/lib/Controller/ShareAPIController.php","line":823,"function":"createShare","class":"OC\\Share20\\Manager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"createShare","class":"OCA\\Files_Sharing\\Controller\\ShareAPIController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Files_Sharing\\Controller\\ShareAPIController"],"createShare"]},{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Files_Sharing\\Controller\\ShareAPIController"],"createShare"]},{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\ShareAPIController","createShare",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["ocs.files_sharing.ShareAPI.createShare"]]},{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/ocs/v1.php","line":65,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/files_sharing/api/v1/shares"]},{"file":"/var/www/html/nextcloud/nextcloud\.domain\.fr/ocs/v2.php","line":23,"args":["/var/www/html/nextcloud/nextcloud\.domain\.fr/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/nextcloud\.domain\.fr/apps/sharebymail/lib/ShareByMailProvider.php","Line":181,"CustomMessage":"Exception thrown: Exception"}}

Additional info

![Uploading 2190 bug partages externes mails.png…]()

Superjamp commented 3 weeks ago

I would like to report a strange behavior we encountered that caused this exact issue in our environment. After upgrading to version 29 and re-enabling our old email template, the test for sending emails failed, and a PHP Fatal error appeared in the logs. Additionally, we tried to share an email link and received the same error message mentioned (just in v29 style). I’m confused as to why PHP interprets this as the error, but that’s what happened in our case.

I hope this points us in the right direction, as I looked through the code and couldn't figure it out myself 🙈

cherrot commented 2 weeks ago

Same issue on Nextcloud Hub 7 (28.0.5)