phpBB3 importer: Fix the link regex

Thanks to Leo Davidson for the improved regex.
https://meta.discourse.org/t/importing-from-phpbb3/30810/153
This commit is contained in:
Gerhard Schlager 2017-02-05 17:13:31 +01:00
parent 14a0dff469
commit 1fb5dac1bc
No known key found for this signature in database
GPG Key ID: 7DACA3C95B36014B
1 changed files with 1 additions and 1 deletions

View File

@ -137,7 +137,7 @@ module ImportScripts::PhpBB3
def create_internal_link_regexps(original_site_prefix)
host = original_site_prefix.gsub('.', '\.')
link_regex = "http(?:s)?://#{host}/viewtopic\\.php\\?(?:\\S*)(?:t=(\\d+)|p=(\\d+)(?:#p\\d+)?)(?:\\S*)"
link_regex = "http(?:s)?://#{host}/viewtopic\\.php\\?(?:\\S*)(?:t=(\\d+)|p=(\\d+)(?:#p\\d+)?)(?:[^\\s\\)\\]]*)"
@long_internal_link_regexp = Regexp.new(%Q|<!-- l --><a(?:.+)href="#{link_regex}"(?:.*)</a><!-- l -->|, Regexp::IGNORECASE)
@short_internal_link_regexp = Regexp.new(link_regex, Regexp::IGNORECASE)