Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/serverinfo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkesselb <mail@danielkesselberg.de>2020-08-26 20:41:00 +0300
committerGitHub <noreply@github.com>2020-08-26 20:41:00 +0300
commit22b82fb923d88a8a6c1537c0d93c6566ec0cb2c6 (patch)
treedf1d6136941148381cdbffca7e92c3109d86ce15
parent8c52a9834c716acd1981e6f06bc9acbedb34d420 (diff)
parentfd9ced6350b8ce41ffe8ee83dd648e15ea602027 (diff)
Merge pull request #229 from nextcloud/backport/228/stable19
[stable19] Match any non-whitespace character in filesystem pattern
-rw-r--r--lib/OperatingSystems/DefaultOs.php2
-rw-r--r--tests/data/df_tp1
-rw-r--r--tests/lib/DefaultOsTest.php8
3 files changed, 10 insertions, 1 deletions
diff --git a/lib/OperatingSystems/DefaultOs.php b/lib/OperatingSystems/DefaultOs.php
index 4ba800e..297940b 100644
--- a/lib/OperatingSystems/DefaultOs.php
+++ b/lib/OperatingSystems/DefaultOs.php
@@ -212,7 +212,7 @@ class DefaultOs {
}
$matches = [];
- $pattern = '/^(?<Filesystem>[\w\/-]+)\s*(?<Type>\w+)\s*(?<Blocks>\d+)\s*(?<Used>\d+)\s*(?<Available>\d+)\s*(?<Capacity>\d+%)\s*(?<Mounted>[\w\/-]+)$/m';
+ $pattern = '/^(?<Filesystem>[\S]+)\s*(?<Type>\w+)\s*(?<Blocks>\d+)\s*(?<Used>\d+)\s*(?<Available>\d+)\s*(?<Capacity>\d+%)\s*(?<Mounted>[\w\/-]+)$/m';
$result = preg_match_all($pattern, $disks, $matches);
if ($result === 0 || $result === false) {
diff --git a/tests/data/df_tp b/tests/data/df_tp
index 4eaf3b4..4d9cbb3 100644
--- a/tests/data/df_tp
+++ b/tests/data/df_tp
@@ -9,3 +9,4 @@ tmpfs tmpfs 4084000 0 4084000
vagrant vboxsf 958123168 614831132 343292036 65% /vagrant
home_vagrant_code vboxsf 958123168 614831132 343292036 65% /home/vagrant/code
tmpfs tmpfs 816800 0 816800 0% /run/user/1000
+nfs.example.com:/export nfs4 14820 0 1230 0% /nfs
diff --git a/tests/lib/DefaultOsTest.php b/tests/lib/DefaultOsTest.php
index 5415e3a..f7b3208 100644
--- a/tests/lib/DefaultOsTest.php
+++ b/tests/lib/DefaultOsTest.php
@@ -171,6 +171,14 @@ class DefaultOsTest extends TestCase {
'percent' => '65%',
'mount' => '/home/vagrant/code',
],
+ [
+ 'device' => 'nfs.example.com:/export',
+ 'fs' => 'nfs4',
+ 'used' => 0,
+ 'available' => 1259520,
+ 'percent' => '0%',
+ 'mount' => '/nfs',
+ ]
];
$this->assertSame($disks, $this->os->getDiskInfo());