Skip to content

Commit 89c7613

Browse files
committed
Merge branch 'template-regexp' into main
2 parents cf8884f + b48ff03 commit 89c7613

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/addressable/template.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Template
3737
Addressable::URI::CharacterClasses::DIGIT + '_'
3838

3939
var_char =
40-
"(?:(?:[#{variable_char_class}]|%[a-fA-F0-9][a-fA-F0-9])+)"
40+
"(?>(?:[#{variable_char_class}]|%[a-fA-F0-9][a-fA-F0-9])+)"
4141
RESERVED =
4242
"(?:[#{anything}]|%[a-fA-F0-9][a-fA-F0-9])"
4343
UNRESERVED =

spec/addressable/template_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
require "spec_helper"
2020

2121
require "bigdecimal"
22+
require "timeout"
2223
require "addressable/template"
2324

2425
shared_examples_for 'expands' do |tests|
@@ -1340,6 +1341,14 @@ def self.match(name)
13401341
expect(subject).not_to match("foo_bar*")
13411342
expect(subject).not_to match("foo_bar:20")
13421343
end
1344+
1345+
it 'should parse in a reasonable time' do
1346+
expect do
1347+
Timeout.timeout(0.1) do
1348+
expect(subject).not_to match("0"*25 + "!")
1349+
end
1350+
end.not_to raise_error
1351+
end
13431352
end
13441353
context "VARIABLE_LIST" do
13451354
subject { Addressable::Template::VARIABLE_LIST }

0 commit comments

Comments
 (0)