twitter-text 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/regex.rb +3 -2
- data/spec/autolinking_spec.rb +17 -1
- metadata +11 -4
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ require 'digest'
|
|
9
9
|
|
10
10
|
spec = Gem::Specification.new do |s|
|
11
11
|
s.name = "twitter-text"
|
12
|
-
s.version = "1.1.
|
12
|
+
s.version = "1.1.6"
|
13
13
|
s.authors = ["Matt Sanford", "Patrick Ewing", "Ben Cherry", "Britt Selvitelle", "Raffi Krikorian"]
|
14
14
|
s.email = ["matt@twitter.com", "patrick.henry.ewing@gmail.com", "bcherry@gmail.com", "bs@brittspace.com", "raffi@twitter.com"]
|
15
15
|
s.homepage = "http://twitter.com"
|
data/lib/regex.rb
CHANGED
@@ -52,15 +52,16 @@ module Twitter
|
|
52
52
|
REGEXEN[:valid_preceding_chars] = /(?:[^\/"':!=]|^|\:)/
|
53
53
|
REGEXEN[:valid_domain] = /(?:[^[:punct:]\s][\.-](?=[^[:punct:]\s])|[^[:punct:]\s]){1,}\.[a-z]{2,}(?::[0-9]+)?/i
|
54
54
|
|
55
|
+
REGEXEN[:valid_general_url_path_chars] = /[a-z0-9!\*';:=\+\$\/%#\[\]\-_,~]/i
|
55
56
|
# Allow URL paths to contain balanced parens
|
56
57
|
# 1. Used in Wikipedia URLs like /Primer_(film)
|
57
58
|
# 2. Used in IIS sessions like /S(dfd346)/
|
58
|
-
REGEXEN[:wikipedia_disambiguation] = /(?:\([
|
59
|
+
REGEXEN[:wikipedia_disambiguation] = /(?:\(#{REGEXEN[:valid_general_url_path_chars]}+\))/i
|
59
60
|
# Allow @ in a url, but only in the middle. Catch things like http://example.com/@user
|
60
61
|
REGEXEN[:valid_url_path_chars] = /(?:
|
61
62
|
#{REGEXEN[:wikipedia_disambiguation]}|
|
62
63
|
@[^\/]+\/|
|
63
|
-
[\.\,]
|
64
|
+
[\.\,]?#{REGEXEN[:valid_general_url_path_chars]}
|
64
65
|
)/ix
|
65
66
|
# Valid end-of-path chracters (so /foo. does not gobble the period).
|
66
67
|
# 1. Allow =&# for empty URL parameters and other URL-join artifacts
|
data/spec/autolinking_spec.rb
CHANGED
@@ -385,6 +385,22 @@ describe Twitter::Autolink do
|
|
385
385
|
@autolinked_text.should have_autolinked_url("http://example.com/i_has_a_")
|
386
386
|
end
|
387
387
|
end
|
388
|
+
|
389
|
+
context "balanced parens with a double quote inside" do
|
390
|
+
def url; "http://foo.bar/foo_(\")_bar" end
|
391
|
+
|
392
|
+
it "should be linked" do
|
393
|
+
@autolinked_text.should have_autolinked_url("http://foo.bar/foo_")
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
context "balanced parens hiding XSS" do
|
398
|
+
def url; 'http://x.xx/("style="color:red"onmouseover="alert(1)' end
|
399
|
+
|
400
|
+
it "should be linked" do
|
401
|
+
@autolinked_text.should have_autolinked_url("http://x.xx/")
|
402
|
+
end
|
403
|
+
end
|
388
404
|
end
|
389
405
|
|
390
406
|
context "when preceded by a :" do
|
@@ -471,7 +487,7 @@ describe Twitter::Autolink do
|
|
471
487
|
end
|
472
488
|
|
473
489
|
end
|
474
|
-
|
490
|
+
|
475
491
|
end
|
476
492
|
|
477
493
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
9
|
+
- 6
|
10
|
+
version: 1.1.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Matt Sanford
|
@@ -18,16 +19,18 @@ autorequire: ""
|
|
18
19
|
bindir: bin
|
19
20
|
cert_chain: []
|
20
21
|
|
21
|
-
date: 2010-
|
22
|
+
date: 2010-08-10 00:00:00 -07:00
|
22
23
|
default_executable:
|
23
24
|
dependencies:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: actionpack
|
26
27
|
prerelease: false
|
27
28
|
requirement: &id001 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
28
30
|
requirements:
|
29
31
|
- - ">="
|
30
32
|
- !ruby/object:Gem::Version
|
33
|
+
hash: 3
|
31
34
|
segments:
|
32
35
|
- 0
|
33
36
|
version: "0"
|
@@ -76,23 +79,27 @@ rdoc_options: []
|
|
76
79
|
require_paths:
|
77
80
|
- lib
|
78
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
79
83
|
requirements:
|
80
84
|
- - ">="
|
81
85
|
- !ruby/object:Gem::Version
|
86
|
+
hash: 3
|
82
87
|
segments:
|
83
88
|
- 0
|
84
89
|
version: "0"
|
85
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
86
92
|
requirements:
|
87
93
|
- - ">="
|
88
94
|
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
89
96
|
segments:
|
90
97
|
- 0
|
91
98
|
version: "0"
|
92
99
|
requirements: []
|
93
100
|
|
94
101
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.3.
|
102
|
+
rubygems_version: 1.3.7
|
96
103
|
signing_key:
|
97
104
|
specification_version: 3
|
98
105
|
summary: Twitter text handling library
|