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

Nextcloud to Seafile sending federated share problems #136

Open
MahdiBaghbani opened this issue Aug 17, 2024 · 2 comments
Open

Nextcloud to Seafile sending federated share problems #136

MahdiBaghbani opened this issue Aug 17, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@MahdiBaghbani
Copy link
Member

From Vincent Lee via cs3org/OCM Matrix chat :

Hello, I'm a Seafile developer and currently working on integrating Seafile and Nextcloud via OCM.

I encountered some issues during development. Let me first describe the problems in detail.

The Seafile server I'm using is https://test.seafile.com

Accessing https://test.seafile.com/ocm-provider/ returns the following:

{
  "apiVersion": "1.0-proposal1",
  "enabled": true,
  "endPoint": "https://test.seafile.com/ocm-via-webdav/",
  "resourceTypes": {
    "name": "file",
    "protocols": {
      "webdav": "/seafdav/"
    },
    "shareTypes": [
      "user"
    ]
  }
}

The Nextcloud server is https://nextcloud.seafile.top, deployed on Ubuntu 22.04.4 LTS, using the snap-installed version 29.0.4snap2.

I can successfully log in to Nextcloud, but when I try to share a file remotely with lian@lian.com@test.seafile.com (where lian@lian.com is a user on test.seafile.com), the page displays "Error creating the share" and the admin-logs page shows the following error.

WX20240815-181132@2x
WX20240815-181911@2x

I also checked the Apache log on test.seafile.com, and only got one log:

112.126.25.132 - - [15/Aug/2024:10:04:06 +0000] "GET /ocm-provider/ HTTP/1.1" 200 2997 "-" "Nextcloud Server Crawler"

@MahdiBaghbani MahdiBaghbani self-assigned this Aug 17, 2024
@MahdiBaghbani
Copy link
Member Author

Replicating that in dev-stock is successful.

Nextcloud version v29.0.4 trying to send a share to lian@lian.com@test.seafile.com shows this error in logs:

{
  "reqId": "WQSVctaCCBSqOYCUITNc",
  "level": 3,
  "time": "2024-08-17T07:45:20+00:00",
  "remoteAddr": "172.18.0.4",
  "user": "einstein",
  "app": "no app in context",
  "method": "POST",
  "url": "/ocs/v2.php/apps/files_sharing/api/v1/shares",
  "message": "OC\\OCM\\Model\\OCMResource::import(): Argument #1 ($data) must be of type array, string given, called in /var/www/html/lib/private/OCM/Model/OCMProvider.php on line 189 in file '/var/www/html/lib/private/OCM/Model/OCMResource.php' line 103",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
  "version": "29.0.4.1",
  "exception": {
    "Exception": "Exception",
    "Message": "OC\\OCM\\Model\\OCMResource::import(): Argument #1 ($data) must be of type array, string given, called in /var/www/html/lib/private/OCM/Model/OCMProvider.php on line 189 in file '/var/www/html/lib/private/OCM/Model/OCMResource.php' line 103",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 338,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/html/ocs/v1.php",
        "line": 66,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/html/ocs/v2.php",
        "line": 23,
        "args": [
          "/var/www/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 170,
    "Previous": {
      "Exception": "TypeError",
      "Message": "OC\\OCM\\Model\\OCMResource::import(): Argument #1 ($data) must be of type array, string given, called in /var/www/html/lib/private/OCM/Model/OCMProvider.php on line 189",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/OCM/Model/OCMProvider.php",
          "line": 189,
          "function": "import",
          "class": "OC\\OCM\\Model\\OCMResource",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/OCM/OCMDiscoveryService.php",
          "line": 98,
          "function": "import",
          "class": "OC\\OCM\\Model\\OCMProvider",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/Federation/CloudFederationProviderManager.php",
          "line": 121,
          "function": "discover",
          "class": "OC\\OCM\\OCMDiscoveryService",
          "type": "->"
        },
        {
          "file": "/var/www/html/apps/federatedfilesharing/lib/Notifications.php",
          "line": 395,
          "function": "sendShare",
          "class": "OC\\Federation\\CloudFederationProviderManager",
          "type": "->"
        },
        {
          "file": "/var/www/html/apps/federatedfilesharing/lib/Notifications.php",
          "line": 320,
          "function": "tryOCMEndPoint",
          "class": "OCA\\FederatedFileSharing\\Notifications",
          "type": "->"
        },
        {
          "file": "/var/www/html/apps/federatedfilesharing/lib/Notifications.php",
          "line": 90,
          "function": "tryHttpPostToShareEndpoint",
          "class": "OCA\\FederatedFileSharing\\Notifications",
          "type": "->"
        },
        {
          "file": "/var/www/html/apps/federatedfilesharing/lib/FederatedShareProvider.php",
          "line": 229,
          "function": "sendRemoteShare",
          "class": "OCA\\FederatedFileSharing\\Notifications",
          "type": "->"
        },
        {
          "file": "/var/www/html/apps/federatedfilesharing/lib/FederatedShareProvider.php",
          "line": 191,
          "function": "createFederatedShare",
          "class": "OCA\\FederatedFileSharing\\FederatedShareProvider",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/Manager.php",
          "line": 748,
          "function": "create",
          "class": "OCA\\FederatedFileSharing\\FederatedShareProvider",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/apps/files_sharing/lib/Controller/ShareAPIController.php",
          "line": 805,
          "function": "createShare",
          "class": "OC\\Share20\\Manager",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 232,
          "function": "createShare",
          "class": "OCA\\Files_Sharing\\Controller\\ShareAPIController",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 138,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 338,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/html/ocs/v1.php",
          "line": 66,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/html/ocs/v2.php",
          "line": 23,
          "args": [
            "/var/www/html/ocs/v1.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/html/lib/private/OCM/Model/OCMResource.php",
      "Line": 103
    },
    "message": "OC\\OCM\\Model\\OCMResource::import(): Argument #1 ($data) must be of type array, string given, called in /var/www/html/lib/private/OCM/Model/OCMProvider.php on line 189 in file '/var/www/html/lib/private/OCM/Model/OCMResource.php' line 103",
    "exception": {},
    "CustomMessage": "OC\\OCM\\Model\\OCMResource::import(): Argument #1 ($data) must be of type array, string given, called in /var/www/html/lib/private/OCM/Model/OCMProvider.php on line 189 in file '/var/www/html/lib/private/OCM/Model/OCMResource.php' line 103"
  }
}

Just like the one Vincent has reported.

@MahdiBaghbani
Copy link
Member Author

The problem is on the Seafile ocm-provider endpoint JSON.

based on the OCM-API documentation

resourceTypes property should be an array of objects, but in seafile JSON this isn't the case:

"resourceTypes": {
    "name": "file",
    "protocols": {
      "webdav": "/seafdav/"
    },
    "shareTypes": [
      "user"
    ]
  }

correct format would be:

"resourceTypes": [
    {
      "name": "file",
      "protocols": {
        "webdav": "/seafdav/"
      },
      "shareTypes": [
        "user"
      ]
    }
  ]

full ocm-provider JSON:

{
  "apiVersion": "1.0-proposal1",
  "enabled": true,
  "endPoint": "https://test.seafile.com/ocm-via-webdav/",
  "resourceTypes": [
    {
      "name": "file",
      "protocols": {
        "webdav": "/seafdav/"
      },
      "shareTypes": [
        "user"
      ]
    }
  ]
}

@MahdiBaghbani MahdiBaghbani changed the title Nextcloud send share problems Nextcloud to Seafile sending federated share problems Aug 17, 2024
@MahdiBaghbani MahdiBaghbani added the bug Something isn't working label Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant