Skip to content

Commit

Permalink
fix: Handle case toolbox don't find any archiving software
Browse files Browse the repository at this point in the history
Closes #703
  • Loading branch information
g-bougard committed Jul 8, 2024
1 parent 8442a20 commit 7e08026
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/GLPI/Agent/HTTP/Server/ToolBox/Results.pm
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ sub handle_form {
}
} elsif ($form->{'submit/export'} || $form->{'submit/full-export'}) {
$self->debug("Doing export for GLPI integration");
my $archiver = $self->_get_archiver();
my $archiver = $self->_get_archiver()
or return $self->errors("Download results: No archiving software available");
my @time = localtime();
my $tag_filter = $self->get_from_session('tag_filter');
my $base_folder = $yaml_config->{networktask_save} || '.';
Expand Down Expand Up @@ -671,6 +672,8 @@ sub _register_supported_modules {
sub _supported_archive_formats {
my ($self) = @_;

return [''] unless $self->{_archive_formats};

my @supported = map { $_->format() } sort { $a->order <=> $b->order } @{$self->{_archive_formats}};

return \@supported;
Expand All @@ -679,6 +682,8 @@ sub _supported_archive_formats {
sub _get_archiver {
my ($self) = @_;

return unless $self->{_archive_formats};

my $yaml_config = $self->yaml('configuration') || {};
my $format = $yaml_config->{'archive_format'} || $self->_supported_archive_formats()->[0];
my ($archiver) = grep { $_->format() eq $format } @{$self->{_archive_formats}};
Expand Down
1 change: 1 addition & 0 deletions share/html/toolbox/errors-language-en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Delete credential:
No credential selected:
Can't delete used credential:

No archiving software available:
Deleting results:
No result selected:
Can't remove file:
Expand Down
1 change: 1 addition & 0 deletions share/html/toolbox/errors-language-fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Delete credential: Suppression d'identifiant
No credential selected: Pas d'identifiant sélectionné
Can't delete used credential: Impossible de supprimer un identifiant utilisé

No archiving software available: Aucun programme d'archivage disponible
Deleting results: Suppression de résultats
No result selected: Pas de résultat sélectionné
Can't remove file: Impossible de supprimer le fichier
Expand Down

0 comments on commit 7e08026

Please sign in to comment.