diff options
author | kesselb <mail@danielkesselberg.de> | 2020-08-26 20:41:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-26 20:41:00 +0300 |
commit | 22b82fb923d88a8a6c1537c0d93c6566ec0cb2c6 (patch) | |
tree | df1d6136941148381cdbffca7e92c3109d86ce15 | |
parent | 8c52a9834c716acd1981e6f06bc9acbedb34d420 (diff) | |
parent | fd9ced6350b8ce41ffe8ee83dd648e15ea602027 (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.php | 2 | ||||
-rw-r--r-- | tests/data/df_tp | 1 | ||||
-rw-r--r-- | tests/lib/DefaultOsTest.php | 8 |
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()); |