diff --git a/lib/GLPI/Agent/HTTP/Server/Proxy.pm b/lib/GLPI/Agent/HTTP/Server/Proxy.pm index 2c1b722e8..8bb533966 100644 --- a/lib/GLPI/Agent/HTTP/Server/Proxy.pm +++ b/lib/GLPI/Agent/HTTP/Server/Proxy.pm @@ -445,19 +445,20 @@ sub _handle_proxy_request { if ($local_store && $action ne "contact") { my $file = $local_store; + my $json = ($message->get("deviceid") || $agentid).".json"; $file =~ s|/*$||; - $file .= "/$agentid.data"; - $self->debug("Saving datas from $remoteid in $file"); + $file .= "/$json"; + $self->debug("Saving $json from $remoteid in $local_store"); my $DATA; unless (open($DATA, '>', $file)) { - $self->error("Can't store datas from $remoteid"); - return $self->proxy_error(500, "Proxy failed to store datas"); + $self->error("Can't store $json from $remoteid"); + return $self->proxy_error(500, "Proxy failed to store json"); } binmode($DATA); print $DATA $content; close($DATA); unless (-s $file == length($content)) { - $self->error("Failed to store datas from $remoteid"); + $self->error("Failed to store $json from $remoteid"); return $self->proxy_error(500, "Proxy storing failure"); } } diff --git a/t/agent/http/server/proxy.t b/t/agent/http/server/proxy.t index a78ffc559..485be70d7 100644 --- a/t/agent/http/server/proxy.t +++ b/t/agent/http/server/proxy.t @@ -417,7 +417,7 @@ SKIP: { chmod 400, $local_store; _request(); subtest "only only_local_store but can't store" => sub { - check_error(500, "Proxy failed to store datas"); + check_error(500, "Proxy failed to store json"); }; chmod 755, $local_store; }