fix: Attachments should not always be deleted with their original document (#1715)
* fix: Attachments should not be deleted when their original document is deleted when referenced elsewhere * fix: Attachments deleted prematurely when docs are placed in trash * mock * restore hook, cascading delete was the issue
This commit is contained in:
8
server/utils/parseAttachmentIds.js
Normal file
8
server/utils/parseAttachmentIds.js
Normal file
@@ -0,0 +1,8 @@
|
||||
// @flow
|
||||
const attachmentRegex = /!\[.*?\]\(\/api\/attachments\.redirect\?id=(?<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\)/gi;
|
||||
|
||||
export default function parseAttachmentIds(text: any): string[] {
|
||||
return [...text.matchAll(attachmentRegex)].map(
|
||||
(match) => match.groups && match.groups.id
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user