mirror of
https://github.com/outline/outline.git
synced 2026-11-28 00:09:58 +03:00
fix: Handle private attachments without documentId (migration process)
This commit is contained in:
1 parent
3b0b37628e
commit
902e7a4772
1 file changed
+6
-4
@@ -17,10 +17,12 @@ router.post('attachments.redirect', auth(), async ctx => {
|
||||
const attachment = await Attachment.findByPk(id);
|
||||
|
||||
if (attachment.isPrivate) {
|
||||
const document = await Document.findByPk(attachment.documentId, {
|
||||
userId: user.id,
|
||||
});
|
||||
authorize(user, 'read', document);
|
||||
if (attachment.documentId) {
|
||||
const document = await Document.findByPk(attachment.documentId, {
|
||||
userId: user.id,
|
||||
});
|
||||
authorize(user, 'read', document);
|
||||
}
|
||||
|
||||
const accessUrl = await getSignedImageUrl(attachment.key);
|
||||
ctx.redirect(accessUrl);
|
||||
|
||||
Reference in new issue
Block a user