Archived
1
0

Fix defense_id generation

This commit is contained in:
Mercier Pierre-Olivier 2013-12-12 05:42:57 +01:00
parent 744c3db27c
commit 33222d78c5

View File

@ -97,7 +97,7 @@ sub tag_defense
my $path;
if ($_[3])
{
if ($_[3] =~ /^(?:defenses\/)?([a-zA-Z0-9_.\/-]+)(?:.xml)?$/) {
if ($_[3] =~ /^(?:defenses\/)?([a-zA-Z0-9_.\/-]+?)(?:.xml)?$/) {
$path = "defenses/".$1.".xml";
} else {
$path = $_[3];
@ -119,12 +119,11 @@ sub tag_defense
chomp($path);
}
my $defense_id;
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.";
}
log WARN, "Placez votre soutenance dans le dossier defenses/." if ($path !~ /^defenses/);
my $defense_id = basename($path);
$defense_id =~ s/\.xml$//;
$defense_id =~ s/[^a-zA-Z0-9_.-]/_/g;
my $year;
if ($_[4])