Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
8ce1d4d6
Commit
8ce1d4d6
authored
6 years ago
by
Acid Chicken (硫酸鶏)
Committed by
syuilo
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix #4576 (#4579)
* Update update.ts * Update api.ts
parent
52225d70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/server/api/endpoints/drive/folders/update.ts
+3
-1
3 additions, 1 deletion
src/server/api/endpoints/drive/folders/update.ts
test/api.ts
+14
-0
14 additions, 0 deletions
test/api.ts
with
17 additions
and
1 deletion
src/server/api/endpoints/drive/folders/update.ts
+
3
−
1
View file @
8ce1d4d6
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
test/api.ts
+
14
−
0
View file @
8ce1d4d6
...
...
@@ -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
'
,
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment