summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api/branches.rb6
-rw-r--r--lib/gitlab/markdown.rb26
2 files changed, 16 insertions, 16 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index edfdf842f85..592100a7045 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -1,5 +1,4 @@
require 'mime/types'
-require 'uri'
module API
# Projects API
@@ -101,10 +100,11 @@ module API
# branch (required) - The name of the branch
# Example Request:
# DELETE /projects/:id/repository/branches/:branch
- delete ":id/repository/branches/:branch" do
+ delete ":id/repository/branches/:branch",
+ requirements: { branch: /.*/ } do
authorize_push_project
result = DeleteBranchService.new(user_project, current_user).
- execute(URI.unescape(params[:branch]))
+ execute(params[:branch])
if result[:status] == :success
{
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index dbc1025855b..1dbea48ac14 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -121,7 +121,7 @@ module Gitlab
markdown_pipeline = HTML::Pipeline::Gitlab.new(filters).pipeline
result = markdown_pipeline.call(text, markdown_context)
-
+
save_options = 0
if options[:xhtml]
save_options |= Nokogiri::XML::Node::SaveOptions::AS_XHTML
@@ -244,18 +244,18 @@ module Gitlab
if identifier == "all"
link_to(
- "@all",
- namespace_project_url(project.namespace, project, only_path: options[:reference_only_path]),
+ "@all",
+ namespace_project_url(project.namespace, project, only_path: options[:reference_only_path]),
link_options
)
elsif namespace = Namespace.find_by(path: identifier)
url =
- if namespace.type == "Group"
+ if namespace.is_a?(Group)
group_url(identifier, only_path: options[:reference_only_path])
- else
+ else
user_url(identifier, only_path: options[:reference_only_path])
end
-
+
link_to("@#{identifier}", url, link_options)
end
end
@@ -300,7 +300,7 @@ module Gitlab
class: "gfm gfm-merge_request #{html_options[:class]}"
)
url = namespace_project_merge_request_url(project.namespace, project,
- merge_request,
+ merge_request,
only_path: options[:reference_only_path])
link_to("#{prefix_text}!#{identifier}", url, link_options)
end
@@ -314,7 +314,7 @@ module Gitlab
)
link_to(
"$#{identifier}",
- namespace_project_snippet_url(project.namespace, project, snippet,
+ namespace_project_snippet_url(project.namespace, project, snippet,
only_path: options[:reference_only_path]),
link_options
)
@@ -330,7 +330,7 @@ module Gitlab
prefix_text = "#{prefix_text}@" if prefix_text
link_to(
"#{prefix_text}#{identifier}",
- namespace_project_commit_url( project.namespace, project, commit,
+ namespace_project_commit_url( project.namespace, project, commit,
only_path: options[:reference_only_path]),
link_options
)
@@ -343,8 +343,8 @@ module Gitlab
inclusive = identifier !~ /\.{3}/
from_id << "^" if inclusive
- if project.valid_repo? &&
- from = project.repository.commit(from_id) &&
+ if project.valid_repo? &&
+ from = project.repository.commit(from_id) &&
to = project.repository.commit(to_id)
link_options = html_options.merge(
@@ -355,8 +355,8 @@ module Gitlab
link_to(
"#{prefix_text}#{identifier}",
- namespace_project_compare_url(project.namespace, project,
- from: from_id, to: to_id,
+ namespace_project_compare_url(project.namespace, project,
+ from: from_id, to: to_id,
only_path: options[:reference_only_path]),
link_options
)