From c0961d086f65a9ee9b6d7520cc97df872f0b5839 Mon Sep 17 00:00:00 2001 From: Jaxom99 <30865395+Jaxom99@users.noreply.github.com> Date: Thu, 14 Dec 2017 12:40:31 +0100 Subject: [PATCH] Handling disk names containing a space Handling disk names containing a space ("Hard drive") by replacing the splitting-line tool : explode() -> preg_split(). I'm no regexp expert, so the prosed one will only match names with one space and letters after the space (so as to not match with the size numbers returned by 'df'. Tested on RPi-2 running Raspbian Jessie with Nginx 1.6.2 --- content/storage/StorageData.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/storage/StorageData.php b/content/storage/StorageData.php index 0aee268..b660bae 100644 --- a/content/storage/StorageData.php +++ b/content/storage/StorageData.php @@ -56,7 +56,8 @@ private function prepareData() private function prepareColumns($row) { - return array_values(array_filter(explode(' ', $row), 'strlen')); + // If names of disks contain spaces (and then lower case char.), still match them as one string + return array_values(array_filter(preg_split('/(\s+)(?=[^a-zA-Z])/', $row), 'strlen')); } public function getData()