diff --git a/src/main/twirl/gitbucket/core/settings/branches.scala.html b/src/main/twirl/gitbucket/core/settings/branches.scala.html
index 15a1ffb..75331a1 100644
--- a/src/main/twirl/gitbucket/core/settings/branches.scala.html
+++ b/src/main/twirl/gitbucket/core/settings/branches.scala.html
@@ -39,7 +39,7 @@
diff --git a/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html b/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html
index 877ee5f..9fb7137 100644
--- a/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html
+++ b/src/main/twirl/gitbucket/core/settings/branchprotection.scala.html
@@ -110,7 +110,7 @@
var protection = getValue();
$.ajax({
method:'PATCH',
- url:'@context.path/api/v3/repos/@repository.owner/@repository.name/branches/@helpers.encodeRefName(branch)',
+ url:'@context.path/api/v3/repos/@repository.owner/@repository.name/branches/@helpers.urlEncode(branch)',
contentType: 'application/json',
dataType: 'json',
data:JSON.stringify({protection:protection}),