From 9d9e90ddeaabe111fa6ef3bf10a0151e87642c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Lindsj=C3=B6?= Date: Sun, 4 Dec 2022 01:04:00 +0100 Subject: [PATCH] Fix incorrect removal of './' when rrdcached is used --- lib/datasources/WeatherMapDataSource_rrd.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/datasources/WeatherMapDataSource_rrd.php b/lib/datasources/WeatherMapDataSource_rrd.php index 40128fc..79e512c 100644 --- a/lib/datasources/WeatherMapDataSource_rrd.php +++ b/lib/datasources/WeatherMapDataSource_rrd.php @@ -67,7 +67,8 @@ function wmrrd_read_from_real_rrdtool_aggregate($rrdfile,$cf,$aggregatefn,$start // rrdcached Support: strip "./" from Data Source if ($map->daemon) { - $rrdfile = trim($rrdfile,"^./"); + if (substr($rrdfile, 0, 2) == "./") + $rrdfile = substr($rrdfile, 2); } // Assemble an array of command args. @@ -209,7 +210,8 @@ function wmrrd_read_from_real_rrdtool($rrdfile,$cf,$start,$end,$dsnames, &$data, // rrdcached Support: strip "./" from Data Source if ($map->daemon) { - $rrdfile = trim($rrdfile,"^./"); + if (substr($rrdfile, 0, 2) == "./") + $rrdfile = substr($rrdfile, 2); } $args[] = "fetch";