dependabot-common 0.113.11 → 0.113.12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e11294f909352aa0f8826372c144b15e8f5ba4d38ac114e784c4537ac4c4c44
|
4
|
+
data.tar.gz: 2ff645789e8130aa5c188d80c6a2656900513e2d1cfdd0176b2fa61726e821f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ab237d88e37547717b86992b029dce437bc0eaab0239133c61f63de20849c5aaecb803043361bbd74e41a8ac3d91017508faf95443057c9e40a618ce45ce052
|
7
|
+
data.tar.gz: bfaae794e512efb73b58f2c5f187d3f67727d89ab0778e6794ea3f3deeeeba8036a654c12c7d271fc900838ab2aa2dd8d0d9a4f981f8af78512a0c326cac76e0
|
@@ -13,7 +13,7 @@ module Dependabot
|
|
13
13
|
github\.com/(?<repo>#{GITHUB_USERNAME}/[^/\s]+)/
|
14
14
|
(?:issue|pull)s?/(?<number>\d+)
|
15
15
|
}x.freeze
|
16
|
-
CODEBLOCK_REGEX =
|
16
|
+
CODEBLOCK_REGEX = /(`+).*?(\1)|~~~.*?~~~/m.freeze
|
17
17
|
# End of string
|
18
18
|
EOS_REGEX = /\z/.freeze
|
19
19
|
|
@@ -26,23 +26,34 @@ module Dependabot
|
|
26
26
|
def sanitize_links_and_mentions(text:)
|
27
27
|
# We don't want to sanitize any links or mentions that are contained
|
28
28
|
# within code blocks, so we split the text on "```" or "~~~"
|
29
|
-
|
29
|
+
sanitized_text = []
|
30
30
|
scan = StringScanner.new(text)
|
31
31
|
until scan.eos?
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
unless delimiter && lines.count { |l| l.include?(delimiter) }.odd?
|
36
|
-
line = sanitize_mentions(line)
|
37
|
-
line = sanitize_links(line)
|
38
|
-
end
|
39
|
-
lines << line
|
32
|
+
block = scan.scan_until(CODEBLOCK_REGEX) ||
|
33
|
+
scan.scan_until(EOS_REGEX)
|
34
|
+
sanitized_text << sanitize_links_and_mentions_in_block(block)
|
40
35
|
end
|
41
|
-
|
36
|
+
sanitized_text.join
|
42
37
|
end
|
43
38
|
|
44
39
|
private
|
45
40
|
|
41
|
+
def sanitize_links_and_mentions_in_block(block)
|
42
|
+
# Handle code blocks one by one
|
43
|
+
normal_text = block
|
44
|
+
verbatim_text = ""
|
45
|
+
match = block.match(CODEBLOCK_REGEX)
|
46
|
+
if match
|
47
|
+
# Part leading up to start of code block
|
48
|
+
normal_text = match.pre_match
|
49
|
+
# Entire code block copied verbatim
|
50
|
+
verbatim_text = match.to_s
|
51
|
+
end
|
52
|
+
normal_text = sanitize_mentions(normal_text)
|
53
|
+
normal_text = sanitize_links(normal_text)
|
54
|
+
normal_text + verbatim_text
|
55
|
+
end
|
56
|
+
|
46
57
|
def sanitize_mentions(text)
|
47
58
|
text.gsub(%r{(?<![A-Za-z0-9`~])@#{GITHUB_USERNAME}/?}) do |mention|
|
48
59
|
next mention if mention.end_with?("/")
|
data/lib/dependabot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.113.
|
4
|
+
version: 0.113.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-codecommit
|