metainspector 5.1.2 → 5.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/meta_inspector/url.rb +1 -1
- data/lib/meta_inspector/version.rb +1 -1
- data/spec/fixtures/invalid_byte_seq.response +20 -0
- data/spec/meta_inspector/links_spec.rb +6 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3d01cdc6e285149cbb1bdb8cf65ebab808da8c1
|
4
|
+
data.tar.gz: 15c37998971b8f63e6829e75049c0f1a819d570d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24e87ba552861135cd0e5cbf98a4f29fbe4d99b27ba4365aec9f5f5902751bda8b7e299c30a83bea3517b4efc18d8677f2278166d95f4adfff673633cf3a4408
|
7
|
+
data.tar.gz: 7585f94e0ba3639da3c2d0d534803b63929987cc43c466135a68b6c6aa0424131b33954e0e72dbec68240e9a33d369368345ced37b70d6fb74c67ee806823e62
|
data/lib/meta_inspector/url.rb
CHANGED
@@ -62,7 +62,7 @@ module MetaInspector
|
|
62
62
|
else
|
63
63
|
Addressable::URI.join(base_url, url).normalize.to_s
|
64
64
|
end
|
65
|
-
rescue MetaInspector::ParserError, Addressable::URI::InvalidURIError
|
65
|
+
rescue MetaInspector::ParserError, Addressable::URI::InvalidURIError, ArgumentError
|
66
66
|
nil
|
67
67
|
end
|
68
68
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx/0.7.67
|
3
|
+
Date: Fri, 18 Nov 2011 21:46:46 GMT
|
4
|
+
Content-Type: text/html
|
5
|
+
Connection: keep-alive
|
6
|
+
Last-Modified: Mon, 14 Nov 2011 16:53:18 GMT
|
7
|
+
Content-Length: 340
|
8
|
+
|
9
|
+
<html>
|
10
|
+
<head>
|
11
|
+
<title>Sample file invalid byte sequence links</title>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<ul>
|
15
|
+
<li><a href="http://pagerankalert.posterous.com">blog</a></li>
|
16
|
+
<li><a href="http://element%b3wgarderoby.com/">invalid</a></li>
|
17
|
+
<li><a href="http://twitter.com/pagerankalert">twitter</a></li>
|
18
|
+
</ul>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -105,6 +105,12 @@ describe MetaInspector do
|
|
105
105
|
m = MetaInspector.new('http://example.com/invalid_href')
|
106
106
|
expect(m.links.non_http).to eq(["skype:joeuser?call", "telnet://telnet.cdrom.com"])
|
107
107
|
end
|
108
|
+
|
109
|
+
it "should not crash with links that have invalid byte sequence, filtering them out" do
|
110
|
+
m = MetaInspector.new('http://example.com/invalid_byte_seq')
|
111
|
+
expect(m.links.all).to eq(["http://pagerankalert.posterous.com/", "http://twitter.com/pagerankalert"])
|
112
|
+
end
|
113
|
+
|
108
114
|
end
|
109
115
|
|
110
116
|
describe 'Relative links' do
|
data/spec/spec_helper.rb
CHANGED
@@ -73,6 +73,7 @@ FakeWeb.register_uri(:get, "http://protocol-relative.com", :response => fixture_
|
|
73
73
|
FakeWeb.register_uri(:get, "https://protocol-relative.com", :response => fixture_file("protocol_relative.response"))
|
74
74
|
FakeWeb.register_uri(:get, "http://example.com/nonhttp", :response => fixture_file("nonhttp.response"))
|
75
75
|
FakeWeb.register_uri(:get, "http://example.com/invalid_href", :response => fixture_file("invalid_href.response"))
|
76
|
+
FakeWeb.register_uri(:get, "http://example.com/invalid_byte_seq", :response => fixture_file("invalid_byte_seq.response"))
|
76
77
|
FakeWeb.register_uri(:get, "http://example.com/malformed_href", :response => fixture_file("malformed_href.response"))
|
77
78
|
FakeWeb.register_uri(:get, "http://www.youtube.com/watch?v=iaGSSrp49uc", :response => fixture_file("youtube.response"))
|
78
79
|
FakeWeb.register_uri(:get, "http://markupvalidator.com/faqs", :response => fixture_file("markupvalidator_faqs.response"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metainspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Iniesta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -317,6 +317,7 @@ files:
|
|
317
317
|
- spec/fixtures/head_links.response
|
318
318
|
- spec/fixtures/https.facebook.com.response
|
319
319
|
- spec/fixtures/international.response
|
320
|
+
- spec/fixtures/invalid_byte_seq.response
|
320
321
|
- spec/fixtures/invalid_href.response
|
321
322
|
- spec/fixtures/iteh.at.response
|
322
323
|
- spec/fixtures/largest_image_in_html.response
|