Commit 47a9cd34 authored by Alex Kalderimis's avatar Alex Kalderimis

Allow parse_filename to handle link matches

The only group they share is simple_file_name, so that is now the first
one we check. In the case of a link match, that group is always
populated with a truthy value, so the fall-through is safe.
parent f0158607
...@@ -69,16 +69,17 @@ module Banzai ...@@ -69,16 +69,17 @@ module Banzai
def self.parse_symbol(raw, match_data) def self.parse_symbol(raw, match_data)
filename = parse_filename(raw, match_data) filename = parse_filename(raw, match_data)
Identifier.new(filename: filename, issue_iid: match_data[:issue].to_i) iid = match_data[:issue].to_i
Identifier.new(filename: filename, issue_iid: iid)
end end
def self.parse_filename(raw, match_data) def self.parse_filename(raw, match_data)
if efn = match_data[:escaped_filename] if name = match_data[:simple_file_name]
name
elsif efn = match_data[:escaped_filename]
efn.gsub(/(\\ \\ | \\ ")/x) { |x| x[1] } efn.gsub(/(\\ \\ | \\ ")/x) { |x| x[1] }
elsif b64_name = match_data[:base_64_encoded_name] elsif b64_name = match_data[:base_64_encoded_name]
Base64.decode64(b64_name) Base64.decode64(b64_name)
elsif name = match_data[:simple_file_name]
name
else else
raise "Unexpected name format: #{raw}" raise "Unexpected name format: #{raw}"
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment