summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/VNDB/DB/VN.pm2
-rw-r--r--lib/VNDB/Handler/Releases.pm2
-rw-r--r--lib/VNDBUtil.pm1
3 files changed, 3 insertions, 2 deletions
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index 55464728..5412ed2a 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -6,7 +6,7 @@ use warnings;
use TUWF 'sqlprint';
use POSIX 'strftime';
use Exporter 'import';
-use VNDB::Func 'gtintype', 'normalize_query';
+use VNDB::Func 'normalize_query';
our @EXPORT = qw|dbVNGet dbVNGetRev dbVNRevisionInsert dbVNImageId dbScreenshotAdd dbScreenshotGet dbScreenshotRandom dbVNImportSeiyuu|;
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 3181566e..2e058fb6 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -217,7 +217,7 @@ sub _infotable {
if($r->{gtin}) {
Tr;
- td gtintype $r->{gtin};
+ td gtintype($r->{gtin}) || 'GTIN';
td $r->{gtin};
end;
}
diff --git a/lib/VNDBUtil.pm b/lib/VNDBUtil.pm
index c8cd1bc1..a534856f 100644
--- a/lib/VNDBUtil.pm
+++ b/lib/VNDBUtil.pm
@@ -23,6 +23,7 @@ sub shorten {
# Also 'normalizes' the first argument in place
sub gtintype {
$_[0] =~ s/[^\d]+//g;
+ return undef if $_[0] !~ /^[0-9]{10,13}$/; # I've yet to see a UPC code shorter than 10 digits assigned to a game
$_[0] = ('0'x(12-length $_[0])) . $_[0] if length($_[0]) < 12; # pad with zeros to GTIN-12
my $c = shift;
return undef if $c !~ /^[0-9]{12,13}$/;