From 924e4b370013ae3a8448a2a68e6a4d353b23b699 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 6 Apr 2016 21:10:24 -0700 Subject: Return status code 303 after a branch DELETE operation to avoid project deletion Closes #14994 --- app/controllers/projects/application_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/controllers/projects/application_controller.rb') diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 657ee94cfd7..74150ad606b 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -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 -- cgit v1.2.3