fix #974
This commit is contained in:
@@ -212,7 +212,12 @@ class WpVersion < WpItem
|
|||||||
|
|
||||||
next if attr_value.nil? || attr_value.empty?
|
next if attr_value.nil? || attr_value.empty?
|
||||||
|
|
||||||
|
begin
|
||||||
uri = Addressable::URI.parse(attr_value)
|
uri = Addressable::URI.parse(attr_value)
|
||||||
|
rescue Addressable::URI::InvalidURIError
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
next unless uri.query && uri.query.match(pattern)
|
next unless uri.query && uri.query.match(pattern)
|
||||||
|
|
||||||
version = Regexp.last_match[1].to_s
|
version = Regexp.last_match[1].to_s
|
||||||
|
|||||||
@@ -159,6 +159,22 @@ describe 'WpVersion::Findable' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '::find_from_stylesheets_numbers' do
|
||||||
|
after do
|
||||||
|
fixture = fixtures_dir + 'stylesheet_numbers' + @fixture
|
||||||
|
stub_request_to_fixture(url: uri, fixture: fixture)
|
||||||
|
|
||||||
|
expect(WpVersion.send(:find_from_stylesheets_numbers, uri)).to eq @expected
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'invalid url' do
|
||||||
|
it 'returns nil' do
|
||||||
|
@fixture = '/invalid_url.html'
|
||||||
|
@expected = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '::find' do
|
describe '::find' do
|
||||||
# Stub all WpVersion::find_from_* to return nil
|
# Stub all WpVersion::find_from_* to return nil
|
||||||
def stub_all_to_nil
|
def stub_all_to_nil
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<script src="//use.typekit.net/h3 {
|
||||||
|
font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 15px;.js"></script><script>try{Typekit.load();}catch(e){}</script>
|
||||||
|
|
||||||
Reference in New Issue
Block a user