aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-26 11:02:02 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-26 11:02:02 +0000
commit9a6acf6c2be15865ff3112981135852e180ef738 (patch)
treefb0de4b4e036b4aea2cba354ec0988c0e13bd923
parent2c4440cf6fc3f70a3b65b01cab5f6ec534077efa (diff)
downloadmgaadvisories-9a6acf6c2be15865ff3112981135852e180ef738.tar
mgaadvisories-9a6acf6c2be15865ff3112981135852e180ef738.tar.gz
mgaadvisories-9a6acf6c2be15865ff3112981135852e180ef738.tar.bz2
mgaadvisories-9a6acf6c2be15865ff3112981135852e180ef738.tar.xz
mgaadvisories-9a6acf6c2be15865ff3112981135852e180ef738.zip
next_id: sort IDs numerically
-rw-r--r--NEWS2
-rw-r--r--lib/MGA/Advisories.pm2
2 files changed, 3 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index b10aeb6..1c23a7a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- fix next free id assignement
+
Version 0.10
- add CVE links in references
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index 9ebe35e..64c128c 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -77,7 +77,7 @@ sub get_advisories_from_dir {
sub next_id {
my $prefix = shift;
my $year = DateTime->now->year;
- my $newid = (0, sort map { m/^$prefix-$year-(\d+)$/ ? int $1 : () } @_)[-1] + 1;
+ my $newid = (0, sort { $a <=> $b } map { m/^$prefix-$year-(\d+)$/ ? int $1 : () } @_)[-1] + 1;
return sprintf("%s-%s-%.4d", $prefix, $year, $newid);
}