notes icon indicating copy to clipboard operation
notes copied to clipboard

Attachments in shared notes are deleted after adding a category

Open mserwan opened this issue 1 year ago • 7 comments

Bug Description When a shared note is categorized by the recipient (without changing ownership), all attachments (e.g., images, videos) within the note are deleted from the server. This issue occurs specifically when the shared user modifies the note's category.

Steps to reproduce User A creates a note with attachments (e.g., images, videos) in the Notes app. User A shares the note with User B. User B changes the category of the shared note (e.g., assigns it to "Work" or "Personal"). Check the note content after the category change.

Expected behaviour The note and its attachments (images, videos, etc.) should remain intact when the recipient changes the category of a shared note.

Actual behaviour Attachments within the note are deleted from the server, and the note no longer displays them. A "Failed to load" error appears for the missing attachments.

mserwan avatar Jan 27 '25 14:01 mserwan

is anyone have idea for this ?

mserwan avatar Feb 07 '25 07:02 mserwan

I can reproduce. Whenever a note is shared to someone and the person edits the category, attachments get broken for whatever reason

enjeck avatar Apr 27 '25 01:04 enjeck

A request is made to /index.php/apps/text/attachments to get attachments with a payload of format:

{
    "documentId": 470,
    "sessionId": 260,
    "sessionToken": "sTCZxevlh3zodXl9efSOKEkxRxshcIS8YmeroY30UvoKBh6Zp86f7V2sK+PW9Dol",
    "shareToken": null
}

Initially, we get results:

[{"fileId":482,"name":"Nextcloud_Server_Administration_Manual.pdf","size":"8.4 MB","mimetype":"application\/pdf","mtime":1745697220,"isImage":false,"davPath":null,"fullUrl":"http:\/\/nextcloud.local\/index.php\/apps\/text\/media?documentId=470&sessionId=260&sessionToken=sTCZxevlh3zodXl9efSOKEkxRxshcIS8YmeroY30UvoKBh6Zp86f7V2sK%2BPW9Dol&mediaFileName=Nextcloud_Server_Administration_Manual.pdf","previewUrl":"http:\/\/nextcloud.local\/index.php\/apps\/text\/mediaPreview?documentId=470&sessionId=260&sessionToken=sTCZxevlh3zodXl9efSOKEkxRxshcIS8YmeroY30UvoKBh6Zp86f7V2sK%2BPW9Dol&mediaFileName=Nextcloud_Server_Administration_Manual.pdf"},{"fileId":472,"name":"img.png","size":"333 KB","mimetype":"image\/png","mtime":1745716256,"isImage":true,"davPath":null,"fullUrl":"http:\/\/nextcloud.local\/index.php\/apps\/text\/image?documentId=470&sessionId=260&sessionToken=sTCZxevlh3zodXl9efSOKEkxRxshcIS8YmeroY30UvoKBh6Zp86f7V2sK%2BPW9Dol&imageFileName=img.png&preferRawImage=1","previewUrl":"http:\/\/nextcloud.local\/index.php\/apps\/text\/image?documentId=470&sessionId=260&sessionToken=sTCZxevlh3zodXl9efSOKEkxRxshcIS8YmeroY30UvoKBh6Zp86f7V2sK%2BPW9Dol&imageFileName=img.png"}]

After the catagory update, the response is empty

enjeck avatar Apr 27 '25 01:04 enjeck

Related to https://github.com/nextcloud/notes/issues/941

enjeck avatar Apr 27 '25 09:04 enjeck

Related to #941

Yes, it was fixed in the old version, but the issue still persists in the new version. Also, the problem described in #1502 continues to be a major issue for us.

mserwan avatar May 16 '25 07:05 mserwan

Also, the problem described in #1502 continues to be a major issue for us.

This got fixed, btw @mserwan

enjeck avatar Aug 08 '25 19:08 enjeck

Whenever a note is shared to someone and the person edits the category, attachments get broken for whatever reason

Likely because the target folder for attachments is got using: $this->noteUtil->getCategoryFolder($notesFolder, $note->getCategory()). So attachments are stored in the same category folder as the note (same directory).

enjeck avatar Oct 31 '25 06:10 enjeck