From 8820785c8fe267789a5c6edf7f4fcb196c48b4a8 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 6 Sep 2015 09:42:39 -0700 Subject: Fix emoji URLs in Markdown when relative_url_root is used Also adds the ability to run rspecs with relative_url_defined on the enviornment. For example: RELATIVE_URL_ROOT=/gitlab rspec Closes #1728 --- lib/gitlab/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index 097caf67a65..ae5f2544691 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -77,7 +77,7 @@ module Gitlab pipeline: options[:pipeline], # EmojiFilter - asset_root: Gitlab.config.gitlab.url, + asset_root: Gitlab.config.gitlab.base_url, asset_host: Gitlab::Application.config.asset_host, # TableOfContentsFilter -- cgit v1.2.3 From 9d3344adbbfc84ef8abc96366bdfa695293cd6c0 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 10 Sep 2015 08:23:10 -0700 Subject: Gracefully handle errors in syntax highlighting by leaving the block unformatted Closes #2433 --- lib/gitlab/markdown/syntax_highlight_filter.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/markdown/syntax_highlight_filter.rb b/lib/gitlab/markdown/syntax_highlight_filter.rb index 86f4385753a..f9527c7286e 100644 --- a/lib/gitlab/markdown/syntax_highlight_filter.rb +++ b/lib/gitlab/markdown/syntax_highlight_filter.rb @@ -21,7 +21,11 @@ module Gitlab language = node.attr('class') code = node.text - highlighted = block_code(code, language) + begin + highlighted = block_code(code, language) + rescue + highlighted = "
#{code}
" + end # Replace the parent `pre` element with the entire highlighted block node.parent.replace(highlighted) -- cgit v1.2.3 From 9bda4b8d88fc93b8938d8c4d001d6660d112ae1c Mon Sep 17 00:00:00 2001 From: Petheo Bence Date: Thu, 3 Sep 2015 15:38:54 +0200 Subject: Added service API endpoint to retrieve service parameters --- lib/api/services.rb | 10 ++++++++++ lib/tasks/services.rake | 9 +++++++++ 2 files changed, 19 insertions(+) (limited to 'lib') diff --git a/lib/api/services.rb b/lib/api/services.rb index 73645cedea4..d170b3067ed 100644 --- a/lib/api/services.rb +++ b/lib/api/services.rb @@ -49,6 +49,16 @@ module API end end end + + # Get service settings for project + # + # Example Request: + # + # GET /project/:id/services/gitlab-ci + # + get ':id/services/:service_slug' do + present project_service + end end end end diff --git a/lib/tasks/services.rake b/lib/tasks/services.rake index 3f276a5e12e..39541c0b9c6 100644 --- a/lib/tasks/services.rake +++ b/lib/tasks/services.rake @@ -40,6 +40,15 @@ DELETE /projects/:id/services/<%= service[:dashed_name] %> ``` +### Get <%= service[:title] %> service settings + +Get <%= service[:title] %> service settings for a project. + +``` +GET /projects/:id/services/<%= service[:dashed_name] %> + +``` + <% end %> ERB -- cgit v1.2.3 From 7cbf5e4d18f6ba0bf1afbddcb090fa39837e9529 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 5 Sep 2015 17:50:47 -0400 Subject: Prevent result of SyntaxHighlightFilter being sanitized --- lib/gitlab/markdown/sanitization_filter.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/markdown/sanitization_filter.rb b/lib/gitlab/markdown/sanitization_filter.rb index 68ed57f6257..54faf981b7d 100644 --- a/lib/gitlab/markdown/sanitization_filter.rb +++ b/lib/gitlab/markdown/sanitization_filter.rb @@ -67,12 +67,16 @@ module Gitlab def clean_spans lambda do |env| - return unless env[:node_name] == 'span' - return unless env[:node].has_attribute?('class') + node = env[:node] - unless has_ancestor?(env[:node], 'pre') - env[:node].remove_attribute('class') + return unless node.name == 'span' + return unless node.has_attribute?('class') + + unless has_ancestor?(node, 'pre') + node.remove_attribute('class') end + + {node_whitelist: [node]} end end end -- cgit v1.2.3 From e3c97ede9663fe7905fcb350875c46526cb4f832 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 10 Sep 2015 16:06:24 -0400 Subject: RU-BO-COOOOOOOOP --- lib/gitlab/markdown/sanitization_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/gitlab/markdown/sanitization_filter.rb b/lib/gitlab/markdown/sanitization_filter.rb index 54faf981b7d..e368de7d848 100644 --- a/lib/gitlab/markdown/sanitization_filter.rb +++ b/lib/gitlab/markdown/sanitization_filter.rb @@ -76,7 +76,7 @@ module Gitlab node.remove_attribute('class') end - {node_whitelist: [node]} + { node_whitelist: [node] } end end end -- cgit v1.2.3 From 267687993a437e0651eb5064c04479e65a43251f Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 10 Sep 2015 14:21:14 -0700 Subject: Add comments and clean up test for !1274 --- lib/gitlab/markdown/syntax_highlight_filter.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/gitlab/markdown/syntax_highlight_filter.rb b/lib/gitlab/markdown/syntax_highlight_filter.rb index f9527c7286e..8597e02f0de 100644 --- a/lib/gitlab/markdown/syntax_highlight_filter.rb +++ b/lib/gitlab/markdown/syntax_highlight_filter.rb @@ -24,6 +24,8 @@ module Gitlab begin highlighted = block_code(code, language) rescue + # Gracefully handle syntax highlighter bugs/errors to ensure + # users can still access an issue/comment/etc. highlighted = "
#{code}
" end -- cgit v1.2.3