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

Error while link sharing #2836

Closed
llucenic opened this issue Dec 22, 2016 · 13 comments
Closed

Error while link sharing #2836

llucenic opened this issue Dec 22, 2016 · 13 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: sharing

Comments

@llucenic
Copy link

I am not able to create a public link to a document on my NC instance. Backend cannot determine share expiration date. Unfortunately, I am not able to tell which upgrade caused this regression. At least NC10 and NC11 affected.

Steps to reproduce

  1. Click on the "Share Link" checkbox in Sharing tab on a document detail pane.

Expected behaviour

Checkbox should be checked and additional link sharing options should appear below it.

Actual behaviour

The checkbox is replaced by a loading icon and after a while message box appears with caption: Error while sharing. Error. Only Ok button in the box.

Server configuration

Operating system: debian 7.11

Web server: apache 2.4.10-10

Database: postgreSQL

PHP version: 5.6.7+dfsg-1

Nextcloud version: (see Nextcloud admin page) 11.0.0.10

Updated from an older Nextcloud/ownCloud or fresh install: OC6 > OC7 > OC8 > OC9 > NC10 > NC11

List of activated apps:

App list Enabled: - activity: 2.4.1 - admin_audit: 1.1.0 - calendar: 1.4.1 - comments: 1.1.0 - contacts: 1.5.2 - dav: 1.1.1 - external: 1.2 - federatedfilesharing: 1.1.1 - federation: 1.1.1 - files: 1.6.1 - files_accesscontrol: 1.1.2 - files_automatedtagging: 1.1.1 - files_external: 1.1.2 - files_mv: 0.8.2 - files_pdfviewer: 1.0.1 - files_retention: 1.0.1 - files_sharing: 1.1.1 - files_texteditor: 2.2 - files_trashbin: 1.1.0 - files_versions: 1.4.0 - files_videoplayer: 1.0.0 - firstrunwizard: 2.0 - gallery: 16.0.0 - logreader: 2.0.0 - lookup_server_connector: 1.0.0 - nextcloud_announcements: 1.0 - notifications: 1.0.1 - password_policy: 1.1.0 - provisioning_api: 1.1.0 - serverinfo: 1.1.1 - sharebymail: 1.0.1 - survey_client: 0.1.5 - systemtags: 1.1.3 - templateeditor: 0.2 - theming: 1.1.1 - twofactor_backupcodes: 1.0.0 - updatenotification: 1.1.1 - user_external: 0.4 - workflowengine: 1.1.1 Disabled: - documents - encryption - ownnote - user_ldap - user_saml

The content of config/config.php:

Config report { "system": { "installed": true, "dbtype": "pgsql", "dbname": "owncloud", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "dbhost": "bariel.digital-orchestra.sk", "dbtableprefix": "oc_", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "forcessl": true, "blacklisted_files": [ ".htaccess" ], "overwritehost": "", "overwriteprotocol": "", "overwritewebroot": "", "overwritecondaddr": "", "theme": "", "default_language": "sk", "3rdpartyroot": "", "3rdpartyurl": "", "defaultapp": "files", "knowledgebaseenabled": true, "knowledgebaseurl": "http:\/\/api.apps.owncloud.com\/v1", "appstoreenabled": true, "appstoreurl": "http:\/\/api.apps.owncloud.com\/v1", "mail_smtpdebug": true, "mail_smtpmode": "smtp", "mail_smtphost": "smtp.krutibrko.sk", "mail_smtpport": "25", "mail_smtptimeout": 10, "mail_smtpauthtype": "LOGIN", "trashbin_retention_obligation": "180, auto", "allow_user_to_change_display_name": true, "appcodechecker": "", "updatechecker": false, "log_type": "owncloud", "logfile": "", "loglevel": 0, "remember_login_cookie_lifetime": 31536000, "session_lifetime": 604800, "custom_csp_policy": "default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src *; font-src 'self' data:; media-src *", "xframe_restriction": true, "maintenance": false, "apps_paths": [ { "path": "\/var\/www\/owncloud\/apps", "url": "\/apps", "writable": true } ], "customclient_desktop": "", "customclient_android": "", "customclient_ios": "", "logdateformat": "F d, Y H:i:s", "logtimezone": "Europe\/Berlin", "instanceid": "52881b38a4a63", "datadirectory": "\/data\/owncloud", "version": "11.0.0.10", "trusted_domains": [ "nextcloud.digital-orchestra.sk", "smtp.krutibrko.sk", "owncloud.digital-orchestra.sk" ], "secret": "***REMOVED SENSITIVE VALUE***", "share_folder": "\/Shared", "mail_from_address": "noreply", "mail_domain": "digital-orchestra.sk", "mail_smtpauth": 1, "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "memcache.local": "\\OC\\Memcache\\APCu", "filelocking.enabled": true } }

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: FF50

Operating system: Linux Mint 17.3 as well as Android

Logs

Nextcloud log (data/nextcloud.log)

Nextcloud log {"reqId":"cxRhY4dfqsuam5x\/0e78","remoteAddr":"185.22.215.103","app":"admin_audit","message":"File accessed: \"\/Knihy\/Anthony de Mello - Bdelos\u0165.pdf\"","level":1,"time":"December 22, 2016 23:22:42","method":"GET","url":"\/remote.php\/webdav\/Knihy\/Anthony%20de%20Mello%20-%20Bdelos%C5%A5.pdf","user":"***","version":"11.0.0.10"} {"reqId":"Vb0ayGY854nbnGJG2TKR","remoteAddr":"185.22.215.103","app":"admin_audit","message":"The file \"\/Shared\/Anthony de Mello - Bdelos\u0165.pdf\" with ID \"149439\" has been shared via link with permissions \"1\" (Share ID: 46)","level":1,"time":"December 22, 2016 23:22:50","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","user":"***","version":"11.0.0.10"} {"reqId":"Vb0ayGY854nbnGJG2TKR","remoteAddr":"185.22.215.103","app":"PHP","message":"Call to a member function format() on boolean at \/data\/www\/nextcloud-11.0.0\/apps\/files_sharing\/lib\/Controller\/ShareAPIController.php#183","level":3,"time":"December 22, 2016 23:22:50","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","user":"***","version":"11.0.0.10"}

Note: user *** is same value for all records

@MorrisJobke
Copy link
Member

  • Call to a member function format() on boolean at apps/files_sharing/lib/Controller/ShareAPIController.php#183
  • POST /ocs/v2.php/apps/files_sharing/api/v1/shares?format=json
  • version: 11.0.0.10

@llucenic Can I ask you to apply following patch:

diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 90274be..79d7771 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -180,7 +180,11 @@ class ShareAPIController extends OCSController {
 
 			$expiration = $share->getExpirationDate();
 			if ($expiration !== null) {
-				$result['expiration'] = $expiration->format('Y-m-d 00:00:00');
+				if ($expiration instanceof \DateTime) {
+					$result['expiration'] = $expiration->format('Y-m-d 00:00:00');
+				} else {
+					\OC::$server->getLogger()->logException(new \Exception('debug2836 ' . ($expiration ? 'true' : 'false')));
+				}
 			}
 
 		} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) {

This adds a log message when this would have happened the next time. Just search the logs for debug2836. From this one we can try to continue to debug this.

@llucenic
Copy link
Author

Hi, I have patched the file and after clicking on the checkbox, I get the following log output:

{"reqId":"lenF3wicfDzuG6g04OBs","remoteAddr":"185.22.215.103","app":"admin_audit","message":"The file \"\/Shared\/Anthony de Mello - Bdelos\u0165.pdf\" with ID \"149439\" has been shared via link with permissions \"1\" (Share ID: 48)","level":1,"time":"January 20, 2017 12:59:19","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","user":"llucenic","version":"11.0.0.10"}

{"reqId":"lenF3wicfDzuG6g04OBs","remoteAddr":"185.22.215.103","app":"no app in context","message":"Exception: {\"Exception\":\"Exception\",\"Message\":\"debug2836 false\",\"Code\":0,\"Trace\":\"#0 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/apps\\\/files_sharing\\\/lib\\\/Controller\\\/ShareAPIController.php(466): OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController->formatShare(Object(OC\\\\Share20\\\\Share))\\n#1 [internal function]: OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController->createShare('\\\/Knihy\\\/Anthony ...', 19, 3, NULL, 'false', '', '2017-02-20 00:0...')\\n#2 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#3 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController), 'createShare')\\n#4 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/lib\\\/private\\\/AppFramework\\\/App.php(114): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController), 'createShare')\\n#5 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('ShareAPIControl...', 'createShare', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#6 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#7 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/lib\\\/private\\\/Route\\\/Router.php(299): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#8 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/ocs\\\/v1.php(79): OC\\\\Route\\\\Router->match('\\\/ocsapp\\\/apps\\\/fi...')\\n#9 \\\/data\\\/www\\\/nextcloud-11.0.0\\\/ocs\\\/v2.php(23): require_once('\\\/data\\\/www\\\/nextc...')\\n#10 {main}\",\"File\":\"\\\/data\\\/www\\\/nextcloud-11.0.0\\\/apps\\\/files_sharing\\\/lib\\\/Controller\\\/ShareAPIController.php\",\"Line\":187}","level":3,"time":"January 20, 2017 12:59:19","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","user":"llucenic","version":"11.0.0.10"}

{"reqId":"1jyuGp6at4AMJHTpuwJO","remoteAddr":"185.22.215.103","app":"admin_audit","message":"The file \"\/Shared\/Anthony de Mello - Bdelos\u0165.pdf\" with ID \"149439\" has been unshared (Share ID: 48)","level":1,"time":"January 20, 2017 12:59:21","method":"GET","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json&path=%2FKnihy%2FAnthony%20de%20Mello%20-%20Bdelos%C5%A5.pdf&reshares=true","user":"llucenic","version":"11.0.0.10"}

Behaviour stays the same, except for no Error message pops up.
Thank you for your help.

@MorrisJobke
Copy link
Member


debug2836 false

#0 apps/files_sharing/lib/Controller/ShareAPIController.php(466): OCA\Files_Sharing\Controller\ShareAPIController->formatShare(Object(OC\Share20\Share))
#1 [internal function]: OCA\Files_Sharing\Controller\ShareAPIController->createShare('/Knihy/Anthony ...', 19, 3, NULL, 'false', '', '2017-02-20 00:0...')
#2 lib/private/AppFramework/Http/Dispatcher.php(160): call_user_func_array(Array, Array)
#3 lib/private/AppFramework/Http/Dispatcher.php(90): OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Files_Sharing\Controller\ShareAPIController), 'createShare')
#4 lib/private/AppFramework/App.php(114): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Files_Sharing\Controller\ShareAPIController), 'createShare')
#5 lib/private/AppFramework/Routing/RouteActionHandler.php(47): OC\AppFramework\App::main('ShareAPIControl...', 'createShare', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#6 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
#7 lib/private/Route/Router.php(299): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
#8 ocs/v1.php(79): OC\Route\Router->match('/ocsapp/apps/fi...')
#9 ocs/v2.php(23): require_once('/data/www/nextc...')
#10 {main}

@schiessle @rullzer could you check out this? Thanks

@MorrisJobke MorrisJobke added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: sharing and removed needs info labels Jan 21, 2017
@rullzer
Copy link
Member

rullzer commented Jan 26, 2017

I don't get why. But it seems that we set the expiration date to false then. I could come up with a patch for this. But that won't magically allow it to create the share. It would just fail at a different point.

But that might be easier to debug. So lets have a look.

@rullzer
Copy link
Member

rullzer commented Jan 26, 2017

Uhm mmm no the OCS API already has checks for this.
@llucenic can you check the DB? And send me a dump of your oc_share table?

@MorrisJobke MorrisJobke added needs info and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jan 26, 2017
@llucenic
Copy link
Author

llucenic commented Feb 8, 2017

Hi @rullzer,
this is my oc_share table: nextcloud-db-dump-20170208-195200.txt, what else should I exactly check on my DB?

Thank you for your assistance, guys.

@ziirish
Copy link

ziirish commented Apr 18, 2017

Hello,

I'm encountering the exact same issue. I added the debug thing as suggested and here is the output:

{"reqId":"n3f\/\/scNocpeRgpvcqYo","remoteAddr":"78.202.41.8","app":"no app in context","message":"Exception: {\"Exception\":\"Exception\",\"Message\":\"debug2836 false\",\"Code\":0,\"Trace\":\"#0 \\\/nextcloud\\\/apps\\\/files_sharing\\\/lib\\\/Controller\\\/ShareAPIController.php(465): OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController->formatShare(Object(OC\\\\Share20\\\\Share))\\n#1 [internal function]: OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController->createShare(Object(OC\\\\Files\\\\Node\\\\File), 19, 3, NULL, 'false', '', Object(DateTime))\\n#2 \\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#3 \\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController), 'createShare')\\n#4 \\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(114): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Files_Sharing\\\\Controller\\\\ShareAPIController), 'createShare')\\n#5 \\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('OCA\\\\\\\\Files_Shari...', 'createShare', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#6 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#7 \\\/nextcloud\\\/lib\\\/private\\\/Route\\\/Router.php(299): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#8 \\\/nextcloud\\\/ocs\\\/v1.php(79): OC\\\\Route\\\\Router->match('\\\/ocsapp\\\/apps\\\/fi...')\\n#9 \\\/nextcloud\\\/ocs\\\/v2.php(23): require_once('\\\/nextcloud\\\/ocs\\\/...')\\n#10 {main}\",\"File\":\"\\\/nextcloud\\\/apps\\\/files_sharing\\\/lib\\\/Controller\\\/ShareAPIController.php\",\"Line\":186}","level":3,"time":"2017-04-18 13:08:58","method":"POST","url":"\/ocs\/v2.php\/apps\/files_sharing\/api\/v1\/shares?format=json","user":"ziirish","version":"11.0.2.7"}

I'm pretty sure this used to work in 11.0 and probably in 11.0.1 too.

The oc_share table contains:

nextcloud_db=# select * from oc_share;
 id | share_type |     share_with     | uid_owner | uid_initiator | parent | item_type | item_source | item_target | file_source |  file_target  | permissions |   stime    | accepted | expiration | token | mail_send 
----+------------+--------------------+-----------+---------------+--------+-----------+-------------+-------------+-------------+---------------+-------------+------------+----------+------------+-------+-----------
  3 |          1 |       group1       | user1     | user1         |        | folder    | 89029       |             |       89029 | /photos_user1 |          31 | 1483272672 |        0 |            |       |         0
  4 |          1 |       group1       | user2     | user2         |        | folder    | 87397       |             |       87397 | /photos_user2 |          31 | 1483273024 |        0 |            |       |         0
 10 |          1 |       group1       | user3     | user3         |        | folder    | 39899       |             |       39899 | /Photos_user3 |          31 | 1486733150 |        0 |            |       |         0
(3 rows)

nextcloud_db=# 

@llucenic
Copy link
Author

I can confirm that the erroneous behaviour persists on my installation after upgrade to current stable NC version 11.0.2.

@ziirish
Copy link

ziirish commented May 23, 2017

Fixed in 12.0

@llucenic
Copy link
Author

I repeatedly confirm the issue persists even after upgrade to NC 12.0.0.

@hgaiser
Copy link

hgaiser commented Jul 7, 2017

I confirm this still seems to be broken in 12.0.0.

@LeoVerto
Copy link

This is still happening on 14.0.3 for me whenever a default expiration time is set.

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Oct 17, 2018
@skjnldsv skjnldsv added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Jun 12, 2019
@skjnldsv
Copy link
Member

As the version of the software you've reported this for has reached end of life, I will close this ticket. If this is still happening after an upgrade to the latest version, feel free to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: sharing
Projects
None yet
Development

No branches or pull requests

8 participants