Skip to content

Attaching a file to a federated share should be blocked. #7092

@max-nextcloud

Description

@max-nextcloud

Describe the bug
Currently it's not possible to attach a file to a federated share of a markdown file.

We should disable the corresponding buttons in the ui and add a tooltip explaining why no files can be attached.

On the server side attempting to attach a file throws 'File has no owner' in the getAttachmentDirectoryForFile function.

To Reproduce
Steps to reproduce the behavior:

  1. Share a file with another nextcloud instance via federation.
  2. Open that file on the other instance.
  3. Try to add an attachment to it.

Expected behavior
The button should be disabled and a tooltip should explain why.

Screenshots
Will be added later.

Server details:

  • Nextcloud version: 28
Logs

Nextcloud log (data/nextcloud.log)

{
  "url": "/apps/text/attachment/upload?documentId=",
  "exception": {
    "Exception": "OCP\\Files\\NotFoundException",
    "Message": "File has no owner",
    "Code": 0,
    "Trace": [
      {
        "file": "/opt/nextcloud/apps/text/lib/Service/AttachmentService.php",
        "line": 287,
        "function": "getAttachmentDirectoryForFile",
        "class": "OCA\\Text\\Service\\AttachmentService",
        "type": "->"
      },
      {
        "file": "/opt/nextcloud/apps/text/lib/Controller/AttachmentController.php",
        "line": 144,
        "function": "uploadAttachment",
        "class": "OCA\\Text\\Service\\AttachmentService",
        "type": "->"
      },
      {
        "file": "/opt/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "uploadAttachment",
        "class": "OCA\\Text\\Controller\\AttachmentController",
        "type": "->"
      },
      {
        "file": "/opt/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/opt/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/opt/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/opt/nextcloud/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/opt/nextcloud/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/opt/nextcloud/apps/text/lib/Service/AttachmentService.php",
    "Line": 436,
    "message": "Upload error",
    "exception": {},
    "CustomMessage": "Upload error"
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

Status

☑️ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions