Archived
1
0

Can give defense file without .xml

This commit is contained in:
Mercier Pierre-Olivier 2013-09-24 00:41:56 +02:00
parent feb887d105
commit e60879ca6e

View File

@ -5,6 +5,7 @@ use warnings;
use v5.10;
use Digest::SHA qw(sha1_base64);
use File::Basename;
use utf8;
use ACU::API::Projects;
use ACU::Defense;
@ -102,7 +103,8 @@ sub tag_defense
$path = $_[3];
}
}
else {
else
{
# Looking for an uniq defense file in defenses/
$path = qx(git ls-tree -r --name-only $ARGV[2] defenses/ | egrep '\.xml\$');
my $nb_defenses = $path =~ tr/\n//;
@ -118,7 +120,7 @@ sub tag_defense
}
my $defense_id;
if ($path =~ /(?:defenses\/)?([a-zA-Z0-9\/]+)(?:.xml)?/) {
if ($path =~ /^(?:defenses\/)?([a-zA-Z0-9\/]+)(?:.xml)?$/) {
$defense_id = $1;
} else {
log ERROR, "Déplacez votre soutenance dans le dossier defenses ou simplifiez le nom du fichier.";