summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api/groups.rb4
-rw-r--r--lib/api/helpers.rb6
-rw-r--r--lib/api/internal.rb2
-rw-r--r--lib/api/project_snippets.rb3
-rw-r--r--lib/api/projects.rb4
-rw-r--r--lib/api/services.rb6
-rw-r--r--lib/api/snippets.rb4
-rw-r--r--lib/api/subscriptions.rb2
-rw-r--r--lib/api/v3/groups.rb4
-rw-r--r--lib/api/v3/project_snippets.rb3
-rw-r--r--lib/api/v3/projects.rb2
-rw-r--r--lib/api/v3/services.rb2
-rw-r--r--lib/api/v3/snippets.rb4
-rw-r--r--lib/api/v3/subscriptions.rb2
-rw-r--r--lib/banzai/filter/external_link_filter.rb36
-rw-r--r--lib/banzai/pipeline/markup_pipeline.rb13
-rw-r--r--lib/ci/ansi2html.rb2
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb2
-rw-r--r--lib/gitlab/access.rb6
-rw-r--r--lib/gitlab/asciidoc.rb8
-rw-r--r--lib/gitlab/chat_commands/command.rb2
-rw-r--r--lib/gitlab/ci/cron_parser.rb2
-rw-r--r--lib/gitlab/cycle_analytics/permissions.rb2
-rw-r--r--lib/gitlab/data_builder/build.rb6
-rw-r--r--lib/gitlab/etag_caching/router.rb2
-rw-r--r--lib/gitlab/file_detector.rb3
-rw-r--r--lib/gitlab/git/blob.rb2
-rw-r--r--lib/gitlab/git/repository.rb2
-rw-r--r--lib/gitlab/git/tree.rb2
-rw-r--r--lib/gitlab/gitaly_client/commit.rb2
-rw-r--r--lib/gitlab/gitaly_client/util.rb2
-rw-r--r--lib/gitlab/kubernetes.rb4
-rw-r--r--lib/gitlab/ldap/config.rb2
-rw-r--r--lib/gitlab/other_markup.rb6
-rw-r--r--lib/gitlab/project_search_results.rb4
-rw-r--r--lib/gitlab/sentry.rb2
-rw-r--r--lib/gitlab/workhorse.rb10
-rw-r--r--lib/tasks/gemojione.rake2
-rw-r--r--lib/tasks/gitlab/info.rake3
-rw-r--r--lib/tasks/gitlab/update_templates.rake2
-rw-r--r--lib/tasks/spec.rake2
41 files changed, 99 insertions, 80 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 09d105f6b4c..3da7d735da8 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -24,7 +24,7 @@ module API
def present_groups(groups, options = {})
options = options.reverse_merge(
with: Entities::Group,
- current_user: current_user,
+ current_user: current_user
)
groups = groups.with_statistics if options[:statistics]
@@ -52,7 +52,7 @@ module API
elsif current_user.admin
Group.all
elsif params[:all_available]
- GroupsFinder.new.execute(current_user)
+ GroupsFinder.new(current_user).execute
else
current_user.groups
end
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 86bf567fe69..226a7ddd50e 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -91,8 +91,8 @@ module API
end
def find_project_snippet(id)
- finder_params = { filter: :by_project, project: user_project }
- SnippetsFinder.new.execute(current_user, finder_params).find(id)
+ finder_params = { project: user_project }
+ SnippetsFinder.new(current_user, finder_params).execute.find(id)
end
def find_merge_request_with_access(iid, access_level = :read_merge_request)
@@ -301,7 +301,7 @@ module API
UploadedFile.new(
file_path,
params["#{field}.name"],
- params["#{field}.type"] || 'application/octet-stream',
+ params["#{field}.type"] || 'application/octet-stream'
)
end
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 2a11790b215..96aaaf868ea 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -90,7 +90,7 @@ module API
{
api_version: API.version,
gitlab_version: Gitlab::VERSION,
- gitlab_rev: Gitlab::REVISION,
+ gitlab_rev: Gitlab::REVISION
}
end
diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb
index cfee38a9baf..98bc9c28527 100644
--- a/lib/api/project_snippets.rb
+++ b/lib/api/project_snippets.rb
@@ -17,8 +17,7 @@ module API
end
def snippets_for_current_user
- finder_params = { filter: :by_project, project: user_project }
- SnippetsFinder.new.execute(current_user, finder_params)
+ SnippetsFinder.new(current_user, project: user_project).execute
end
end
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 9a6cb43abf7..ed5004e8d1a 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -69,7 +69,7 @@ module API
options = options.reverse_merge(
with: Entities::Project,
current_user: current_user,
- simple: params[:simple],
+ simple: params[:simple]
)
projects = filter_projects(projects)
@@ -226,7 +226,7 @@ module API
:shared_runners_enabled,
:snippets_enabled,
:visibility,
- :wiki_enabled,
+ :wiki_enabled
]
optional :name, type: String, desc: 'The name of the project'
optional :default_branch, type: String, desc: 'The default branch of the project'
diff --git a/lib/api/services.rb b/lib/api/services.rb
index 23ef62c2258..cb07df9e249 100644
--- a/lib/api/services.rb
+++ b/lib/api/services.rb
@@ -356,7 +356,7 @@ module API
name: :ca_pem,
type: String,
desc: 'A custom certificate authority bundle to verify the Kubernetes cluster with (PEM format)'
- },
+ }
],
'mattermost-slash-commands' => [
{
@@ -559,7 +559,7 @@ module API
SlackService,
MattermostService,
MicrosoftTeamsService,
- TeamcityService,
+ TeamcityService
]
if Rails.env.development?
@@ -577,7 +577,7 @@ module API
service_classes += [
MockCiService,
MockDeploymentService,
- MockMonitoringService,
+ MockMonitoringService
]
end
diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb
index b93fdc62808..53f5953a8fb 100644
--- a/lib/api/snippets.rb
+++ b/lib/api/snippets.rb
@@ -8,11 +8,11 @@ module API
resource :snippets do
helpers do
def snippets_for_current_user
- SnippetsFinder.new.execute(current_user, filter: :by_user, user: current_user)
+ SnippetsFinder.new(current_user, author: current_user).execute
end
def public_snippets
- SnippetsFinder.new.execute(current_user, filter: :public)
+ SnippetsFinder.new(current_user, visibility: Snippet::PUBLIC).execute
end
end
diff --git a/lib/api/subscriptions.rb b/lib/api/subscriptions.rb
index dbe54d3cd31..91567909998 100644
--- a/lib/api/subscriptions.rb
+++ b/lib/api/subscriptions.rb
@@ -5,7 +5,7 @@ module API
subscribable_types = {
'merge_requests' => proc { |id| find_merge_request_with_access(id, :update_merge_request) },
'issues' => proc { |id| find_project_issue(id) },
- 'labels' => proc { |id| find_project_label(id) },
+ 'labels' => proc { |id| find_project_label(id) }
}
params do
diff --git a/lib/api/v3/groups.rb b/lib/api/v3/groups.rb
index 63d464b926b..6187445fc8d 100644
--- a/lib/api/v3/groups.rb
+++ b/lib/api/v3/groups.rb
@@ -20,7 +20,7 @@ module API
def present_groups(groups, options = {})
options = options.reverse_merge(
with: Entities::Group,
- current_user: current_user,
+ current_user: current_user
)
groups = groups.with_statistics if options[:statistics]
@@ -45,7 +45,7 @@ module API
groups = if current_user.admin
Group.all
elsif params[:all_available]
- GroupsFinder.new.execute(current_user)
+ GroupsFinder.new(current_user).execute
else
current_user.groups
end
diff --git a/lib/api/v3/project_snippets.rb b/lib/api/v3/project_snippets.rb
index fc065a22d74..c41fee32610 100644
--- a/lib/api/v3/project_snippets.rb
+++ b/lib/api/v3/project_snippets.rb
@@ -18,8 +18,7 @@ module API
end
def snippets_for_current_user
- finder_params = { filter: :by_project, project: user_project }
- SnippetsFinder.new.execute(current_user, finder_params)
+ SnippetsFinder.new(current_user, project: user_project).execute
end
end
diff --git a/lib/api/v3/projects.rb b/lib/api/v3/projects.rb
index 06cc704afc6..164612cb8dd 100644
--- a/lib/api/v3/projects.rb
+++ b/lib/api/v3/projects.rb
@@ -88,7 +88,7 @@ module API
options = options.reverse_merge(
with: ::API::V3::Entities::Project,
current_user: current_user,
- simple: params[:simple],
+ simple: params[:simple]
)
projects = filter_projects(projects)
diff --git a/lib/api/v3/services.rb b/lib/api/v3/services.rb
index 61629a04174..118c6df6549 100644
--- a/lib/api/v3/services.rb
+++ b/lib/api/v3/services.rb
@@ -377,7 +377,7 @@ module API
name: :ca_pem,
type: String,
desc: 'A custom certificate authority bundle to verify the Kubernetes cluster with (PEM format)'
- },
+ }
],
'mattermost-slash-commands' => [
{
diff --git a/lib/api/v3/snippets.rb b/lib/api/v3/snippets.rb
index 07dac7e9904..0762fc02d70 100644
--- a/lib/api/v3/snippets.rb
+++ b/lib/api/v3/snippets.rb
@@ -8,11 +8,11 @@ module API
resource :snippets do
helpers do
def snippets_for_current_user
- SnippetsFinder.new.execute(current_user, filter: :by_user, user: current_user)
+ SnippetsFinder.new(current_user, author: current_user).execute
end
def public_snippets
- SnippetsFinder.new.execute(current_user, filter: :public)
+ SnippetsFinder.new(current_user, visibility: Snippet::PUBLIC).execute
end
end
diff --git a/lib/api/v3/subscriptions.rb b/lib/api/v3/subscriptions.rb
index 068750ec077..690768db82f 100644
--- a/lib/api/v3/subscriptions.rb
+++ b/lib/api/v3/subscriptions.rb
@@ -7,7 +7,7 @@ module API
'merge_request' => proc { |id| find_merge_request_with_access(id, :update_merge_request) },
'merge_requests' => proc { |id| find_merge_request_with_access(id, :update_merge_request) },
'issues' => proc { |id| find_project_issue(id) },
- 'labels' => proc { |id| find_project_label(id) },
+ 'labels' => proc { |id| find_project_label(id) }
}
params do
diff --git a/lib/banzai/filter/external_link_filter.rb b/lib/banzai/filter/external_link_filter.rb
index d67d466bce8..7d15a0f6d44 100644
--- a/lib/banzai/filter/external_link_filter.rb
+++ b/lib/banzai/filter/external_link_filter.rb
@@ -2,16 +2,17 @@ module Banzai
module Filter
# HTML Filter to modify the attributes of external links
class ExternalLinkFilter < HTML::Pipeline::Filter
+ SCHEMES = ['http', 'https', nil].freeze
+
def call
links.each do |node|
- href = href_to_lowercase_scheme(node["href"].to_s)
+ uri = uri(node['href'].to_s)
+ next unless uri
- unless node["href"].to_s == href
- node.set_attribute('href', href)
- end
+ node.set_attribute('href', uri.to_s)
- if href =~ %r{\A(https?:)?//[^/]} && external_url?(href)
- node.set_attribute('rel', 'nofollow noreferrer')
+ if SCHEMES.include?(uri.scheme) && external_url?(uri)
+ node.set_attribute('rel', 'nofollow noreferrer noopener')
node.set_attribute('target', '_blank')
end
end
@@ -21,27 +22,26 @@ module Banzai
private
+ def uri(href)
+ URI.parse(href)
+ rescue URI::InvalidURIError
+ nil
+ end
+
def links
query = 'descendant-or-self::a[@href and not(@href = "")]'
doc.xpath(query)
end
- def href_to_lowercase_scheme(href)
- scheme_match = href.match(/\A(\w+):\/\//)
-
- if scheme_match
- scheme_match.to_s.downcase + scheme_match.post_match
- else
- href
- end
- end
+ def external_url?(uri)
+ # Relative URLs miss a hostname
+ return false unless uri.hostname
- def external_url?(url)
- !url.start_with?(internal_url)
+ uri.hostname != internal_url.hostname
end
def internal_url
- @internal_url ||= Gitlab.config.gitlab.url
+ @internal_url ||= URI.parse(Gitlab.config.gitlab.url)
end
end
end
diff --git a/lib/banzai/pipeline/markup_pipeline.rb b/lib/banzai/pipeline/markup_pipeline.rb
new file mode 100644
index 00000000000..c56d908009f
--- /dev/null
+++ b/lib/banzai/pipeline/markup_pipeline.rb
@@ -0,0 +1,13 @@
+module Banzai
+ module Pipeline
+ class MarkupPipeline < BasePipeline
+ def self.filters
+ @filters ||= FilterArray[
+ Filter::SanitizationFilter,
+ Filter::ExternalLinkFilter,
+ Filter::PlantumlFilter
+ ]
+ end
+ end
+ end
+end
diff --git a/lib/ci/ansi2html.rb b/lib/ci/ansi2html.rb
index b439b0ee29b..55402101e43 100644
--- a/lib/ci/ansi2html.rb
+++ b/lib/ci/ansi2html.rb
@@ -20,7 +20,7 @@ module Ci
italic: 0x02,
underline: 0x04,
conceal: 0x08,
- cross: 0x10,
+ cross: 0x10
}.freeze
def self.convert(ansi, state = nil)
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 15a461a16dd..b06474cda7f 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -70,7 +70,7 @@ module Ci
cache: job[:cache],
dependencies: job[:dependencies],
after_script: job[:after_script],
- environment: job[:environment],
+ environment: job[:environment]
}.compact
}
end
diff --git a/lib/gitlab/access.rb b/lib/gitlab/access.rb
index 8c28009b9c6..4714ab18cc1 100644
--- a/lib/gitlab/access.rb
+++ b/lib/gitlab/access.rb
@@ -32,7 +32,7 @@ module Gitlab
"Guest" => GUEST,
"Reporter" => REPORTER,
"Developer" => DEVELOPER,
- "Master" => MASTER,
+ "Master" => MASTER
}
end
@@ -47,7 +47,7 @@ module Gitlab
guest: GUEST,
reporter: REPORTER,
developer: DEVELOPER,
- master: MASTER,
+ master: MASTER
}
end
@@ -60,7 +60,7 @@ module Gitlab
"Not protected: Both developers and masters can push new commits, force push, or delete the branch." => PROTECTION_NONE,
"Protected against pushes: Developers cannot push new commits, but are allowed to accept merge requests to the branch." => PROTECTION_DEV_CAN_MERGE,
"Partially protected: Developers can push new commits, but cannot force push or delete the branch. Masters can do all of those." => PROTECTION_DEV_CAN_PUSH,
- "Fully protected: Developers cannot push new commits, force push, or delete the branch. Only masters can do any of those." => PROTECTION_FULL,
+ "Fully protected: Developers cannot push new commits, force push, or delete the branch. Only masters can do any of those." => PROTECTION_FULL
}
end
diff --git a/lib/gitlab/asciidoc.rb b/lib/gitlab/asciidoc.rb
index fba80c7132e..96d38f6daa0 100644
--- a/lib/gitlab/asciidoc.rb
+++ b/lib/gitlab/asciidoc.rb
@@ -15,17 +15,17 @@ module Gitlab
#
# input - the source text in Asciidoc format
#
- def self.render(input)
+ def self.render(input, context)
asciidoc_opts = { safe: :secure,
backend: :gitlab_html5,
attributes: DEFAULT_ADOC_ATTRS }
+ context[:pipeline] = :markup
+
plantuml_setup
html = ::Asciidoctor.convert(input, asciidoc_opts)
-
- filter = Banzai::Filter::SanitizationFilter.new(html)
- html = filter.call.to_s
+ html = Banzai.render(html, context)
html.html_safe
end
diff --git a/lib/gitlab/chat_commands/command.rb b/lib/gitlab/chat_commands/command.rb
index f34ed0f4cf2..3e0c30c33b7 100644
--- a/lib/gitlab/chat_commands/command.rb
+++ b/lib/gitlab/chat_commands/command.rb
@@ -5,7 +5,7 @@ module Gitlab
Gitlab::ChatCommands::IssueShow,
Gitlab::ChatCommands::IssueNew,
Gitlab::ChatCommands::IssueSearch,
- Gitlab::ChatCommands::Deploy,
+ Gitlab::ChatCommands::Deploy
].freeze
def execute
diff --git a/lib/gitlab/ci/cron_parser.rb b/lib/gitlab/ci/cron_parser.rb
index dad8c3cdf5b..551483d0aaa 100644
--- a/lib/gitlab/ci/cron_parser.rb
+++ b/lib/gitlab/ci/cron_parser.rb
@@ -11,7 +11,7 @@ module Gitlab
def next_time_from(time)
@cron_line ||= try_parse_cron(@cron, @cron_timezone)
- @cron_line.next_time(time).in_time_zone(Time.zone) if @cron_line.present?
+ @cron_line.next_time(time).utc.in_time_zone(Time.zone) if @cron_line.present?
end
def cron_valid?
diff --git a/lib/gitlab/cycle_analytics/permissions.rb b/lib/gitlab/cycle_analytics/permissions.rb
index bef3b95ff1b..1e11e84a9cb 100644
--- a/lib/gitlab/cycle_analytics/permissions.rb
+++ b/lib/gitlab/cycle_analytics/permissions.rb
@@ -7,7 +7,7 @@ module Gitlab
test: :read_build,
review: :read_merge_request,
staging: :read_build,
- production: :read_issue,
+ production: :read_issue
}.freeze
def self.get(*args)
diff --git a/lib/gitlab/data_builder/build.rb b/lib/gitlab/data_builder/build.rb
index f78106f5b10..8e74e18a311 100644
--- a/lib/gitlab/data_builder/build.rb
+++ b/lib/gitlab/data_builder/build.rb
@@ -36,7 +36,7 @@ module Gitlab
user: {
id: user.try(:id),
name: user.try(:name),
- email: user.try(:email),
+ email: user.try(:email)
},
commit: {
@@ -49,7 +49,7 @@ module Gitlab
status: commit.status,
duration: commit.duration,
started_at: commit.started_at,
- finished_at: commit.finished_at,
+ finished_at: commit.finished_at
},
repository: {
@@ -60,7 +60,7 @@ module Gitlab
git_http_url: project.http_url_to_repo,
git_ssh_url: project.ssh_url_to_repo,
visibility_level: project.visibility_level
- },
+ }
}
data
diff --git a/lib/gitlab/etag_caching/router.rb b/lib/gitlab/etag_caching/router.rb
index 692c909d838..31a5b9d108b 100644
--- a/lib/gitlab/etag_caching/router.rb
+++ b/lib/gitlab/etag_caching/router.rb
@@ -40,7 +40,7 @@ module Gitlab
Gitlab::EtagCaching::Router::Route.new(
%r(^(?!.*(#{RESERVED_WORDS})).*/pipelines/\d+\.json\z),
'project_pipeline'
- ),
+ )
].freeze
def self.match(env)
diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb
index c9ca4cadd1c..f8b3d0b4965 100644
--- a/lib/gitlab/file_detector.rb
+++ b/lib/gitlab/file_detector.rb
@@ -13,7 +13,8 @@ module Gitlab
gitignore: '.gitignore',
koding: '.koding.yml',
gitlab_ci: '.gitlab-ci.yml',
- avatar: /\Alogo\.(png|jpg|gif)\z/
+ avatar: /\Alogo\.(png|jpg|gif)\z/,
+ route_map: 'route-map.yml'
}.freeze
# Returns an Array of file types based on the given paths.
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb
index 12458f9f410..c1b31618e0d 100644
--- a/lib/gitlab/git/blob.rb
+++ b/lib/gitlab/git/blob.rb
@@ -90,7 +90,7 @@ module Gitlab
name: blob_entry[:name],
data: '',
path: path,
- commit_id: sha,
+ commit_id: sha
)
end
end
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 9ed12ead023..256318cb833 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -258,7 +258,7 @@ module Gitlab
'RepoPath' => path,
'ArchivePrefix' => prefix,
'ArchivePath' => archive_file_path(prefix, storage_path, format),
- 'CommitId' => commit.id,
+ 'CommitId' => commit.id
}
end
diff --git a/lib/gitlab/git/tree.rb b/lib/gitlab/git/tree.rb
index b722d8a9f56..d41256d9a84 100644
--- a/lib/gitlab/git/tree.rb
+++ b/lib/gitlab/git/tree.rb
@@ -35,7 +35,7 @@ module Gitlab
type: entry[:type],
mode: entry[:filemode].to_s(8),
path: path ? File.join(path, entry[:name]) : entry[:name],
- commit_id: sha,
+ commit_id: sha
)
end
end
diff --git a/lib/gitlab/gitaly_client/commit.rb b/lib/gitlab/gitaly_client/commit.rb
index 0b001a9903d..8e9323b05e1 100644
--- a/lib/gitlab/gitaly_client/commit.rb
+++ b/lib/gitlab/gitaly_client/commit.rb
@@ -34,7 +34,7 @@ module Gitlab
left_commit_id: parent_id,
right_commit_id: commit.id,
ignore_whitespace_change: options.fetch(:ignore_whitespace_change, false),
- paths: options.fetch(:paths, []),
+ paths: options.fetch(:paths, [])
)
Gitlab::Git::DiffCollection.new(stub.commit_diff(request), options)
diff --git a/lib/gitlab/gitaly_client/util.rb b/lib/gitlab/gitaly_client/util.rb
index 4acd297f5cb..86d055d3533 100644
--- a/lib/gitlab/gitaly_client/util.rb
+++ b/lib/gitlab/gitaly_client/util.rb
@@ -6,7 +6,7 @@ module Gitlab
Gitaly::Repository.new(
path: File.join(Gitlab.config.repositories.storages[repository_storage]['path'], relative_path),
storage_name: repository_storage,
- relative_path: relative_path,
+ relative_path: relative_path
)
end
end
diff --git a/lib/gitlab/kubernetes.rb b/lib/gitlab/kubernetes.rb
index 3a7af363548..4a6091488c8 100644
--- a/lib/gitlab/kubernetes.rb
+++ b/lib/gitlab/kubernetes.rb
@@ -38,7 +38,7 @@ module Gitlab
url: container_exec_url(api_url, namespace, pod_name, container["name"]),
subprotocols: ['channel.k8s.io'],
headers: Hash.new { |h, k| h[k] = [] },
- created_at: created_at,
+ created_at: created_at
}
end
end
@@ -64,7 +64,7 @@ module Gitlab
tty: true,
stdin: true,
stdout: true,
- stderr: true,
+ stderr: true
}.to_query + '&' + EXEC_COMMAND
case url.scheme
diff --git a/lib/gitlab/ldap/config.rb b/lib/gitlab/ldap/config.rb
index 46deea3cc9f..6fdf68641e2 100644
--- a/lib/gitlab/ldap/config.rb
+++ b/lib/gitlab/ldap/config.rb
@@ -39,7 +39,7 @@ module Gitlab
def adapter_options
opts = base_options.merge(
- encryption: encryption,
+ encryption: encryption
)
opts.merge!(auth_options) if has_auth?
diff --git a/lib/gitlab/other_markup.rb b/lib/gitlab/other_markup.rb
index c2adc9aa10b..31a24460f0f 100644
--- a/lib/gitlab/other_markup.rb
+++ b/lib/gitlab/other_markup.rb
@@ -5,12 +5,12 @@ module Gitlab
#
# input - the source text in a markup format
#
- def self.render(file_name, input)
+ def self.render(file_name, input, context)
html = GitHub::Markup.render(file_name, input).
force_encoding(input.encoding)
+ context[:pipeline] = :markup
- filter = Banzai::Filter::SanitizationFilter.new(html)
- html = filter.call.to_s
+ html = Banzai.render(html, context)
html.html_safe
end
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb
index 0b8959f2fb9..47cfe412715 100644
--- a/lib/gitlab/project_search_results.rb
+++ b/lib/gitlab/project_search_results.rb
@@ -82,6 +82,8 @@ module Gitlab
private
def blobs
+ return [] unless Ability.allowed?(@current_user, :download_code, @project)
+
@blobs ||= begin
blobs = project.repository.search_files_by_content(query, repository_ref).first(100)
found_file_names = Set.new
@@ -102,6 +104,8 @@ module Gitlab
end
def wiki_blobs
+ return [] unless Ability.allowed?(@current_user, :read_wiki, @project)
+
@wiki_blobs ||= begin
if project.wiki_enabled? && query.present?
project_wiki = ProjectWiki.new(project)
diff --git a/lib/gitlab/sentry.rb b/lib/gitlab/sentry.rb
index 117fc508135..2442c2ded3b 100644
--- a/lib/gitlab/sentry.rb
+++ b/lib/gitlab/sentry.rb
@@ -11,7 +11,7 @@ module Gitlab
Raven.user_context(
id: current_user.id,
email: current_user.email,
- username: current_user.username,
+ username: current_user.username
)
end
end
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index 8c5ad01e8c2..351e2b10595 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -22,7 +22,7 @@ module Gitlab
params = {
GL_ID: Gitlab::GlId.gl_id(user),
GL_REPOSITORY: Gitlab::GlRepository.gl_repository(project, is_wiki),
- RepoPath: repo_path,
+ RepoPath: repo_path
}
if Gitlab.config.gitaly.enabled
@@ -51,7 +51,7 @@ module Gitlab
{
StoreLFSPath: "#{Gitlab.config.lfs.storage_path}/tmp/upload",
LfsOid: oid,
- LfsSize: size,
+ LfsSize: size
}
end
@@ -62,7 +62,7 @@ module Gitlab
def send_git_blob(repository, blob)
params = {
'RepoPath' => repository.path_to_repo,
- 'BlobId' => blob.id,
+ 'BlobId' => blob.id
}
[
@@ -127,7 +127,7 @@ module Gitlab
'Subprotocols' => terminal[:subprotocols],
'Url' => terminal[:url],
'Header' => terminal[:headers],
- 'MaxSessionTime' => terminal[:max_session_time],
+ 'MaxSessionTime' => terminal[:max_session_time]
}
}
details['Terminal']['CAPem'] = terminal[:ca_pem] if terminal.has_key?(:ca_pem)
@@ -165,7 +165,7 @@ module Gitlab
encoded_message,
secret,
true,
- { iss: 'gitlab-workhorse', verify_iss: true, algorithm: 'HS256' },
+ { iss: 'gitlab-workhorse', verify_iss: true, algorithm: 'HS256' }
)
end
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake
index b5572a39d30..87ca39b079b 100644
--- a/lib/tasks/gemojione.rake
+++ b/lib/tasks/gemojione.rake
@@ -21,7 +21,7 @@ namespace :gemojione do
moji: emoji_hash['moji'],
description: emoji_hash['description'],
unicodeVersion: Gitlab::Emoji.emoji_unicode_version(name),
- digest: hash_digest,
+ digest: hash_digest
}
resultant_emoji_map[name] = entry
diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake
index a2a2db487b7..e3883278886 100644
--- a/lib/tasks/gitlab/info.rake
+++ b/lib/tasks/gitlab/info.rake
@@ -16,6 +16,8 @@ namespace :gitlab do
redis_version = run_and_match(%w(redis-cli --version), /redis-cli (\d+\.\d+\.\d+)/).to_a
# check Git version
git_version = run_and_match([Gitlab.config.git.bin_path, '--version'], /git version ([\d\.]+)/).to_a
+ # check Go version
+ go_version = run_and_match(%w(go version), /go version (.+)/).to_a
puts ""
puts "System information".color(:yellow)
@@ -30,6 +32,7 @@ namespace :gitlab do
puts "Redis Version:\t#{redis_version[1] || "unknown".color(:red)}"
puts "Git Version:\t#{git_version[1] || "unknown".color(:red)}"
puts "Sidekiq Version:#{Sidekiq::VERSION}"
+ puts "Go Version:\t#{go_version[1] || "unknown".color(:red)}"
# check database adapter
database_adapter = ActiveRecord::Base.connection.adapter_name.downcase
diff --git a/lib/tasks/gitlab/update_templates.rake b/lib/tasks/gitlab/update_templates.rake
index 1b04e1350ed..59c32bbe7a4 100644
--- a/lib/tasks/gitlab/update_templates.rake
+++ b/lib/tasks/gitlab/update_templates.rake
@@ -49,7 +49,7 @@ namespace :gitlab do
Template.new(
"https://gitlab.com/gitlab-org/Dockerfile.git",
/(\.{1,2}|LICENSE|CONTRIBUTING.md|\.Dockerfile)\z/
- ),
+ )
].freeze
def vendor_directory
diff --git a/lib/tasks/spec.rake b/lib/tasks/spec.rake
index 602c60be828..2eddcb3c777 100644
--- a/lib/tasks/spec.rake
+++ b/lib/tasks/spec.rake
@@ -60,7 +60,7 @@ desc "GitLab | Run specs"
task :spec do
cmds = [
%w(rake gitlab:setup),
- %w(rspec spec),
+ %w(rspec spec)
]
run_commands(cmds)
end