Fix graph output base64 (#14701)

Mostly for people using unauth graphs instead of the api.
This commit is contained in:
Tony Murray
2022-12-15 15:58:56 -06:00
committed by GitHub
parent 1d3440b943
commit 88c86f2a19
2 changed files with 3 additions and 5 deletions

View File

@@ -4,7 +4,6 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use LibreNMS\Config;
use LibreNMS\Enum\ImageFormat;
use LibreNMS\Exceptions\RrdGraphException;
use LibreNMS\Util\Debug;
@@ -19,7 +18,6 @@ class GraphController extends Controller
public function __invoke(Request $request, string $path = ''): Response
{
$vars = array_merge(Url::parseLegacyPathVars($request->path()), $request->except(['username', 'password']));
$output = $vars['graph_type'] ?? Config::get('webui.graph_type', 'default');
if (\Auth::check()) {
// only allow debug for logged in users
@@ -37,8 +35,8 @@ class GraphController extends Controller
'Content-type' => $graph->contentType(),
];
if ($output == 'base64') {
return response($graph, 200, $headers);
if ($request->get('output') == 'base64') {
return response($graph->base64(), 200, $headers);
}
return response($graph->data, 200, $headers);