mirror of
https://github.com/outline/outline.git
synced 2026-12-06 11:12:32 +03:00
fix: documents.duplicate returns 403 for an unknown collectionId (#14750)
This commit is contained in:
1 parent
12862f5c18
commit
9d39e07a7d
2 files changed
+19
-1
No files matched your search
@@ -9768,6 +9768,24 @@ describe("#documents.duplicate", () => {
|
||||
expect(res.status).toEqual(401);
|
||||
});
|
||||
|
||||
it("should fail with status 403 for an unknown collectionId", async () => {
|
||||
const user = await buildUser();
|
||||
const document = await buildDocument({
|
||||
userId: user.id,
|
||||
teamId: user.teamId,
|
||||
});
|
||||
|
||||
const res = await server.post("/api/documents.duplicate", user, {
|
||||
body: {
|
||||
id: document.id,
|
||||
collectionId: faker.string.uuid(),
|
||||
publish: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.status).toEqual(403);
|
||||
});
|
||||
|
||||
it("should duplicate a document with fullWidth property", async () => {
|
||||
const user = await buildUser();
|
||||
const document = await buildDocument({
|
||||
|
||||
@@ -1580,7 +1580,7 @@ router.post(
|
||||
|
||||
// The copy is created in the destination collection, so create permission
|
||||
// is required there rather than on the source.
|
||||
if (collection) {
|
||||
if (collectionId || collection) {
|
||||
authorize(user, "createDocument", collection);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user