summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/VNDB/BBCode.pm2
-rw-r--r--lib/VNDB/Util/ValidateTemplates.pm2
-rwxr-xr-xutil/bbcode-test.pl6
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/VNDB/BBCode.pm b/lib/VNDB/BBCode.pm
index 3f623405..c1de1f7f 100644
--- a/lib/VNDB/BBCode.pm
+++ b/lib/VNDB/BBCode.pm
@@ -56,7 +56,7 @@ sub _link {
return ('link') if $match =~ /^[hf]t/;
# Now we're left with various forms of IDs, just need to make sure it's not surrounded by word characters
- return ('dblink') if $char_pre !~ /\w/ && $char_post !~ /\w/;
+ return ('dblink') if $char_pre !~ /[\w-]/ && $char_post !~ /[\w-]/;
();
}
diff --git a/lib/VNDB/Util/ValidateTemplates.pm b/lib/VNDB/Util/ValidateTemplates.pm
index 540ff709..7966b319 100644
--- a/lib/VNDB/Util/ValidateTemplates.pm
+++ b/lib/VNDB/Util/ValidateTemplates.pm
@@ -14,7 +14,7 @@ TUWF::set(
validate_templates => {
id => { template => 'uint', max => 1<<40 },
page => { template => 'uint', max => 1000 },
- uname => { regex => qr/^[a-z0-9-]*$/, minlength => 2, maxlength => 15 },
+ uname => { regex => qr/^[a-z0-9-]*$/, func => sub { $_[0] !~ /^-*[a-z][0-9]+-*$/ }, minlength => 2, maxlength => 15 },
gtin => { func => \&gtintype },
editsum => { maxlength => 5000, minlength => 2 },
json => { func => \&json_validate, inherit => ['json_fields','json_maxitems','json_unique','json_sort'], default => [] },
diff --git a/util/bbcode-test.pl b/util/bbcode-test.pl
index 1100b34e..0ad0f3ea 100755
--- a/util/bbcode-test.pl
+++ b/util/bbcode-test.pl
@@ -109,9 +109,9 @@ my @tests = (
'<a href="/d3">d3</a> <a href="/d1.3">d1.3</a> <a href="/d2#4">d2#4</a> <a href="/d5#6.7">d5#6.7</a>',
'd3 d1.3 d2#4 d5#6.7',
- 'v17 text dds16v21 more text1 v9',
- '<a href="/v17">v17</a> text dds16v21 more text1 <a href="/v9">v9</a>',
- 'v17 text dds16v21 more text1 v9',
+ 'v17 text dds16v21 more text1 v9 _d5_ d3-',
+ '<a href="/v17">v17</a> text dds16v21 more text1 <a href="/v9">v9</a> _d5_ d3-',
+ 'v17 text dds16v21 more text1 v9 _d5_ d3-',
# https://vndb.org/t2520.233
'[From[url=http://densetsu.com/display.php?id=468&style=alphabetical] Anime Densetsu[/url]]',