Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit a396dec

Browse files
committed
Simplify pattern and stop non-numeric characters being returned
1 parent 11ea690 commit a396dec

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/wpxf/wordpress/fingerprint.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def check_version_from_custom_file(url, regex, fixed = nil, introduced = nil)
7979

8080
private
8181

82-
WORDPRESS_VERSION_PATTERN = '([^\r\n"\']+\.[^\r\n"\']+)'
82+
WORDPRESS_VERSION_PATTERN = '(\d+\.\d+(?:\.\d+)*)'
8383

8484
WORDPRESS_GENERATOR_VERSION_PATTERN = %r{<meta\sname="generator"\s
8585
content="WordPress\s#{WORDPRESS_VERSION_PATTERN}"\s\/>}xi

spec/wordpress/fingerprint_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636

3737
describe '#wordpress_version' do
3838
let(:body) do
39-
'<meta name="generator" content="WordPress 4.0" />'
39+
'<meta name="generator" content="WordPress 4.7.1" />'
4040
end
4141

4242
it 'returns the WordPress version number' do
43-
expect(subject.wordpress_version).to eq Gem::Version.new('4.0')
43+
expect(subject.wordpress_version).to eq Gem::Version.new('4.7.1')
4444
end
4545
end
4646

0 commit comments

Comments
 (0)