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