Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
924e4b37
Commit
924e4b37
authored
Apr 06, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return status code 303 after a branch DELETE operation to avoid project deletion
Closes #14994
parent
8f094531
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+3
-1
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+1
-1
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+14
-0
No files found.
CHANGELOG
View file @
924e4b37
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.7.0 (unreleased)
- All images in discussions and wikis now link to their source files !3464 (Connor Shea).
- Return status code 303 after a branch DELETE operation to avoid project deletion (Stan Hu)
- Improved Markdown rendering performance !3389 (Yorick Peterse)
- Don't attempt to look up an avatar in repo if repo directory does not exist (Stan Hu)
- Preserve time notes/comments have been updated at when moving issue
...
...
app/controllers/projects/application_controller.rb
View file @
924e4b37
...
...
@@ -68,7 +68,9 @@ class Projects::ApplicationController < ApplicationController
end
def
require_non_empty_project
redirect_to
namespace_project_path
(
@project
.
namespace
,
@project
)
if
@project
.
empty_repo?
# Be sure to return status code 303 to avoid a double DELETE:
# http://api.rubyonrails.org/classes/ActionController/Redirecting.html
redirect_to
namespace_project_path
(
@project
.
namespace
,
@project
),
status:
303
if
@project
.
empty_repo?
end
def
require_branch_head
...
...
app/controllers/projects/branches_controller.rb
View file @
924e4b37
...
...
@@ -48,7 +48,7 @@ class Projects::BranchesController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
do
redirect_to
namespace_project_branches_path
(
@project
.
namespace
,
@project
)
@project
)
,
status:
303
end
format
.
js
{
render
status:
status
[
:return_code
]
}
end
...
...
spec/controllers/projects/branches_controller_spec.rb
View file @
924e4b37
...
...
@@ -93,6 +93,20 @@ describe Projects::BranchesController do
end
end
describe
"POST destroy with HTML format"
do
render_views
it
'returns 303'
do
post
:destroy
,
format: :html
,
id:
'foo/bar/baz'
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
expect
(
response
.
status
).
to
eq
(
303
)
end
end
describe
"POST destroy"
do
render_views
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment