diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2020-08-26 19:05:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-26 19:05:37 +0300 |
commit | e3dc3bfee023314f6e94762f83907e8622d5ee9e (patch) | |
tree | fa9006a0bbf3fb7d01383e67abd48eb85e6e8045 | |
parent | fe6496d5a258546d73920ef550848f4f23db6278 (diff) | |
parent | 57668af4640f36df2426a38a46b9e89bf42d83bd (diff) |
Merge pull request #228 from nextcloud/bugfix/noid/disk-nfsv20.0.0beta2
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 650fc4a..ed0a665 100644 --- a/lib/OperatingSystems/DefaultOs.php +++ b/lib/OperatingSystems/DefaultOs.php @@ -209,7 +209,7 @@ class DefaultOs implements IOperatingSystem { } $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 7f3eb6c..790b7ae 100644 --- a/tests/lib/DefaultOsTest.php +++ b/tests/lib/DefaultOsTest.php @@ -166,6 +166,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()); |