Skip to content
Snippets Groups Projects
Commit 8ce1d4d6 authored by Acid Chicken (硫酸鶏)'s avatar Acid Chicken (硫酸鶏) Committed by syuilo
Browse files

Fix #4576 (#4579)

* Update update.ts

* Update api.ts
parent 52225d70
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,9 @@ export default define(meta, async (ps, user) => {
if (ps.name) folder.name = ps.name;
if (ps.parentId !== undefined) {
if (ps.parentId === null) {
if (ps.parentId.equals(folder._id)) {
throw new ApiError(meta.errors.recursiveNesting);
} else if (ps.parentId === null) {
folder.parentId = null;
} else {
// Get parent folder
......
......@@ -1141,6 +1141,20 @@ describe('API', () => {
expect(res).have.status(400);
}));
it('フォルダが循環するような構造にできない(自身)', async(async () => {
const arisugawa = await signup({ username: 'arisugawa' });
const folderA = (await request('/drive/folders/create', {
name: 'test'
}, arisugawa)).body;
const res = await request('/drive/folders/update', {
folderId: folderA.id,
parentId: folderA.id
}, arisugawa);
expect(res).have.status(400);
}));
it('存在しない親フォルダを設定できない', async(async () => {
const alice = await signup({ username: 'alice' });
const folder = (await request('/drive/folders/create', {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment