From 5d11dad2ab83429eb68553e2b970f7509cc61473 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 8 Jan 2018 17:40:37 +0100 Subject: BBCode: Fix parsing of tags in [something[url=..] https://vndb.org/t2520.233 The old bb2html() blindly replaced [url=..] anywhere inside the matched token, and did not require that the [url=..] was itself the token. I've made the tag matching more strict to make sure that [something[url=..] is now properly tokenized. This also affects other tags, so it's likely that there's some input that the old bb2html() would still have handled differently. --- lib/VNDB/BBCode.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/VNDB/BBCode.pm') diff --git a/lib/VNDB/BBCode.pm b/lib/VNDB/BBCode.pm index b95ef760..d2f3135d 100644 --- a/lib/VNDB/BBCode.pm +++ b/lib/VNDB/BBCode.pm @@ -111,11 +111,11 @@ sub parse { my @stack; while($raw =~ m{(?: - \[[^\s\]]+\] | # tag - d[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]* | # d#.#.# - [tdvprcs][1-9][0-9]*\.[1-9][0-9]* | # v#.# - [tdvprcsugi][1-9][0-9]* | # v# - (?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-] # link + \[ \/? (?i: spoiler|quote|code|url|raw ) [^\s\]]* \] | # tag + d[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]* | # d#.#.# + [tdvprcs][1-9][0-9]*\.[1-9][0-9]* | # v#.# + [tdvprcsugi][1-9][0-9]* | # v# + (?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-] # link )}xg) { my $token = $&; my $pre = substr $raw, $last, $-[0]-$last; -- cgit v1.2.3