Fixes #1404
This commit is contained in:
@@ -101,7 +101,7 @@ module WPScan
|
||||
#
|
||||
# @return [ String ]
|
||||
def parse_style_tag(body, tag)
|
||||
value = body[/^\s*#{Regexp.escape(tag)}:[\t ]*([^\r\n]+)/i, 1]
|
||||
value = body[/#{Regexp.escape(tag)}:[\t ]*([^\r\n\*]+)/i, 1]
|
||||
|
||||
value && !value.strip.empty? ? value.strip : nil
|
||||
end
|
||||
|
||||
@@ -10,10 +10,9 @@ describe WPScan::Model::Theme do
|
||||
before { expect(blog).to receive(:content_dir).at_least(1).and_return('wp-content') }
|
||||
|
||||
describe '#new' do
|
||||
before do
|
||||
stub_request(:get, /.*\.css\z/)
|
||||
.to_return(body: File.read(fixtures.join('style.css')))
|
||||
end
|
||||
before { stub_request(:get, /.*\.css\z/).to_return(body: File.read(fixture)) }
|
||||
|
||||
let(:fixture) { fixtures.join('style.css') }
|
||||
|
||||
its(:url) { should eql 'http://wp.lab/wp-content/themes/spec/' }
|
||||
its(:style_url) { should eql 'http://wp.lab/wp-content/themes/spec/style.css' }
|
||||
@@ -34,6 +33,14 @@ describe WPScan::Model::Theme do
|
||||
|
||||
its(:style_url) { should eql opts[:style_url] }
|
||||
end
|
||||
|
||||
context 'when some new lines are stripped' do
|
||||
let(:fixture) { fixtures.join('stripped_new_lines.css') }
|
||||
|
||||
its(:style_name) { should eql 'Divi' }
|
||||
its(:style_uri) { should eql 'http://www.elegantthemes.com/gallery/divi/' }
|
||||
its(:license_uri) { should eql 'http://www.gnu.org/licenses/gpl-2.0.html' }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#version' do
|
||||
|
||||
9
spec/fixtures/models/theme/stripped_new_lines.css
vendored
Normal file
9
spec/fixtures/models/theme/stripped_new_lines.css
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!Theme Name: Divi
|
||||
Theme URI: http://www.elegantthemes.com/gallery/divi/
|
||||
Version: 3.29.3
|
||||
Description: Smart. Flexible. Beautiful. Divi is the most powerful theme in our collection.
|
||||
Author: Elegant Themes
|
||||
Author URI: http://www.elegantthemes.com
|
||||
Tags: responsive-layout, one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, custom-background, custom-colors, featured-images, full-width-template, post-formats, rtl-language-support, theme-options, threaded-comments, translation-ready
|
||||
License: GNU General Public License v2
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html*/a,abbr,acronym,address,applet,b,big,blockquote,body
|
||||
Reference in New Issue
Block a user