Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow dot in mounted on #665

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/OperatingSystems/Linux.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function getDiskInfo(): array {
}

$matches = [];
$pattern = '/^(?<Filesystem>[\S]+)\s*(?<Type>[\S]+)\s*(?<Blocks>\d+)\s*(?<Used>\d+)\s*(?<Available>\d+)\s*(?<Capacity>\d+%)\s*(?<Mounted>[\w\/-]+)$/m';
$pattern = '/^(?<Filesystem>[\S]+)\s*(?<Type>[\S]+)\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) {
Expand Down
1 change: 1 addition & 0 deletions tests/data/linux_df_tp
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ home_vagrant_code vboxsf 958123168 614831132 343292036
tmpfs tmpfs 816800 0 816800 0% /run/user/1000
nfs.example.com:/export nfs4 14820 0 1230 0% /nfs
198.51.100.42:/storage fuse.sshfs 47929956 53116 45419052 1% /mnt/sshfs
/dev/vda5 ext4 205314024 110088996 84722884 57% /nextcloud/my.cloud.domain.xx
10 changes: 9 additions & 1 deletion tests/lib/LinuxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,15 @@ public function testGetDiskInfo(): void {
$disk6->setPercent('1%');
$disk6->setMount('/mnt/sshfs');

$this->assertEquals([$disk1, $disk2, $disk3, $disk4, $disk5, $disk6], $this->os->getDiskInfo());
$disk7 = new Disk();
$disk7->setDevice('/dev/vda5');
$disk7->setFs('ext4');
$disk7->setUsed(107508);
$disk7->setAvailable(82737);
$disk7->setPercent('57%');
$disk7->setMount('/nextcloud/my.cloud.domain.xx');

$this->assertEquals([$disk1, $disk2, $disk3, $disk4, $disk5, $disk6, $disk7], $this->os->getDiskInfo());
}

public function testGetDiskInfoNoCommandOutput(): void {
Expand Down
Loading