Skip to content
Merged
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
14 changes: 11 additions & 3 deletions emhttp/plugins/dynamix/nchan/device_list
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ function pool_function_row(string $label, ?array $poolDisk, ?array $firstMember,

$disk['fsStatus'] = _var($fsOverride,'fsStatus',_var($poolDisk,'fsStatus',_var($firstMember,'fsStatus','')));
$disk['fsType'] = _var($fsOverride,'fsType',_var($poolDisk,'fsType',_var($firstMember,'fsType','')));
$disk['fsMountpoint'] = _var($fsOverride,'fsMountpoint',_var($poolDisk,'fsMountpoint',_var($firstMember,'fsMountpoint','')));
$disk['fsSize'] = _var($metrics,'fsSize',_var($poolDisk,'fsSize',_var($firstMember,'fsSize','')));
$disk['fsUsed'] = _var($metrics,'fsUsed',_var($poolDisk,'fsUsed',_var($firstMember,'fsUsed','')));
$disk['fsFree'] = _var($metrics,'fsFree',_var($poolDisk,'fsFree',_var($firstMember,'fsFree','')));
Expand Down Expand Up @@ -489,7 +490,7 @@ function device_info(&$disk,$online,$poolName='',$poolstatusData=[], $options=[]
$view = "<a class='view' href=\"/Main/Browse?dir=".htmlspecialchars($dir)."\"><i class=\"icon-u-tab\" title=\""._('Browse')." $dir\"></i></a>";
}
if (!$showView) $view = $showViewPlaceholder ? "<a class='view'></a>" : "";
if ($showView && _var($options,'forceView',false) && $dir !== '') {
if ($showView && _var($options,'forceView',false) && _var($disk,'fsStatus')=='Mounted' && $dir !== '') {
$view = "<a class='view' href=\"/Main/Browse?dir=".htmlspecialchars($dir)."\"><i class=\"icon-u-tab\" title=\""._('Browse')." $dir\"></i></a>";
Comment on lines +493 to 494
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Apply the empty-mountpoint guard to the primary Browse branch too.

This hardens only the forceView override. The normal path above can still emit /Main/Browse?dir= when fsMountpoint is missing, so browse behavior is still inconsistent between forced and non-forced rows.

🩹 Minimal follow-up
-  if (!$online || _var($disk,'fsStatus')!='Mounted' || (in_array(_var($disk,'type'),['Parity','Cache']) && (!in_array(_var($disk,'name'),$pools) || isSubpool(_var($disk,'name'))))) {
+  if (!$online || _var($disk,'fsStatus')!='Mounted' || $dir === '' || (in_array(_var($disk,'type'),['Parity','Cache']) && (!in_array(_var($disk,'name'),$pools) || isSubpool(_var($disk,'name'))))) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@emhttp/plugins/dynamix/nchan/device_list` around lines 493 - 494, The primary
Browse branch can emit a trailing empty dir param when fsMountpoint is missing;
add the same empty-mountpoint guard used for the forceView branch so the normal
Browse link is only created when $dir !== ''. Update the condition that builds
$view for the non-forced path (the branch that currently creates
"/Main/Browse?dir=".htmlspecialchars($dir)) to include the $dir !== '' check
alongside the existing checks (_var($disk,'fsStatus')=='Mounted' and $showView)
so both forced and regular rows behave consistently.

}
if ($indent) $view = "<span style='padding-left:{$indent}px'></span>".$view;
Expand Down Expand Up @@ -1098,6 +1099,7 @@ while (true) {
$bootFsStatus = get_mount_status_from_mountpoint($mountPoint, true);
if ($bootFsStatus === '') $bootFsStatus = 'Unknown';
}
$bootMountPoint = _var($poolBootDisk,'mountPoint','') ?: _var($poolBootDisk,'fsMountpoint','') ?: _var($bootFsInfo,'mountPoint','') ?: _var($bootFsInfo,'fsMountpoint','') ?: '/boot';

$bootRow = pool_function_row(
'<i class="fa fa-paw title"></i> '._('Boot Partition'),
Expand All @@ -1110,17 +1112,19 @@ while (true) {
[
'fsType' => $bootFsType,
'fsStatus' => $bootFsStatus,
'fsMountpoint' => $bootMountPoint,
],
true,
$bootPoolName,
$bootSummaryName,
false,
true,
'pool_boot_'.$pool
);
if ($bootRow !== '') $echo[$a][] = $bootRow;

if ($bootPoolMode !== 'dedicated') {
$dataLabel = isSubpool($pool) ? _('ZFS subpool') : _('Data Partition');
$showDataSummaryView = _var($var,'fsState') != 'Stopped';
$dataRow = pool_function_row(
'<i class="fa fa-bullseye title"></i> '.$dataLabel,
$poolDisk,
Expand All @@ -1133,7 +1137,7 @@ while (true) {
true,
'',
$dataSummaryName,
false
$showDataSummaryView
);
if ($dataRow !== '') $echo[$a][] = $dataRow;
}
Expand Down Expand Up @@ -1241,6 +1245,7 @@ while (true) {
$bootFsStatus = get_mount_status_from_mountpoint($mountPoint, true);
if ($bootFsStatus === '') $bootFsStatus = 'Unknown';
}
$bootMountPoint = _var($bootDisk,'mountPoint','') ?: _var($bootDisk,'fsMountpoint','') ?: _var($bootFsInfo,'mountPoint','') ?: _var($bootFsInfo,'fsMountpoint','') ?: '/boot';
$bootRow = pool_function_row(
'<i class="fa fa-paw title"></i> '._('Boot Partition'),
$poolDisk,
Expand All @@ -1252,6 +1257,7 @@ while (true) {
[
'fsType' => $bootFsType,
'fsStatus' => $bootFsStatus,
'fsMountpoint' => $bootMountPoint,
],
true,
$bootPoolName,
Expand Down Expand Up @@ -1380,6 +1386,7 @@ while (true) {
$bootFsStatus = get_mount_status_from_mountpoint($mountPoint, true);
if ($bootFsStatus === '') $bootFsStatus = 'Unknown';
}
$bootMountPoint = _var($bootDisk,'mountPoint','') ?: _var($bootDisk,'fsMountpoint','') ?: _var($bootFsInfo,'mountPoint','') ?: _var($bootFsInfo,'fsMountpoint','') ?: '/boot';
$bootRow = pool_function_row(
'<i class="fa fa-paw title"></i> '._('Boot Partition'),
$poolDisk,
Expand All @@ -1391,6 +1398,7 @@ while (true) {
[
'fsType' => $bootFsType,
'fsStatus' => $bootFsStatus,
'fsMountpoint' => $bootMountPoint,
],
true,
$bootPoolName,
Expand Down
Loading