diff --git a/server/routes/api/attachments/attachments.test.ts b/server/routes/api/attachments/attachments.test.ts index 15d50287c3..7d001f7327 100644 --- a/server/routes/api/attachments/attachments.test.ts +++ b/server/routes/api/attachments/attachments.test.ts @@ -258,7 +258,7 @@ describe("#attachments.create", () => { expect(attachment.expiresAt).toBeTruthy(); }); - it("should not allow viewer to upload using import preset", async () => { + it("should allow viewer to upload using import preset", async () => { const user = await buildViewer(); const res = await server.post("/api/attachments.create", user, { body: { @@ -268,7 +268,13 @@ describe("#attachments.create", () => { preset: AttachmentPreset.Import, }, }); - expect(res.status).toEqual(403); + expect(res.status).toEqual(200); + + const body = await res.json(); + const attachment = await Attachment.findByPk(body.data.attachment.id, { + rejectOnEmpty: true, + }); + expect(attachment.expiresAt).toBeTruthy(); }); it("should not allow attachment creation for other documents", async () => { diff --git a/server/routes/api/attachments/attachments.ts b/server/routes/api/attachments/attachments.ts index 8c952c2f5a..ac70e7729d 100644 --- a/server/routes/api/attachments/attachments.ts +++ b/server/routes/api/attachments/attachments.ts @@ -106,9 +106,6 @@ router.post( if (preset === AttachmentPreset.WorkspaceImport) { authorize(user, "createImport", user.team); } - if (preset === AttachmentPreset.Import) { - authorize(user, "createDocument", user.team); - } if (preset === AttachmentPreset.Emoji) { assertIn(contentType, AttachmentValidation.emojiContentTypes); }