Improved followup regex (quote ticket_hook).

This commit is contained in:
Martin Edenhofer 2017-03-06 12:19:49 +01:00
parent 199bf8773a
commit aa6ba57cde
2 changed files with 4 additions and 4 deletions

View file

@ -82,12 +82,12 @@ module Ticket::Number::Date
ticket = nil
# probe format
string.scan(/#{ticket_hook}#{ticket_hook_divider}(#{system_id}\d{2,48})/i) {
string.scan(/#{Regexp.quote(ticket_hook)}#{Regexp.quote(ticket_hook_divider)}(#{system_id}\d{2,48})/i) {
ticket = Ticket.find_by(number: $1)
break if ticket
}
if !ticket
string.scan(/#{ticket_hook}\s{0,2}(#{system_id}\d{2,48})/i) {
string.scan(/#{Regexp.quote(ticket_hook)}\s{0,2}(#{system_id}\d{2,48})/i) {
ticket = Ticket.find_by(number: $1)
break if ticket
}

View file

@ -79,12 +79,12 @@ module Ticket::Number::Increment
ticket = nil
# probe format
string.scan(/#{ticket_hook}#{ticket_hook_divider}(#{system_id}\d{2,48})/i) {
string.scan(/#{Regexp.quote(ticket_hook)}#{Regexp.quote(ticket_hook_divider)}(#{system_id}\d{2,48})/i) {
ticket = Ticket.find_by(number: $1)
break if ticket
}
if !ticket
string.scan(/#{ticket_hook}\s{0,2}(#{system_id}\d{2,48})/i) {
string.scan(/#{Regexp.quote(ticket_hook)}\s{0,2}(#{system_id}\d{2,48})/i) {
ticket = Ticket.find_by(number: $1)
break if ticket
}