Do not show log details pane if empty

This commit is contained in:
itismadness
2025-09-28 23:23:00 +00:00
committed by Spine
parent 8787b9f80b
commit 39cd6fc2b4
3 changed files with 27 additions and 2 deletions

View File

@@ -507,7 +507,7 @@ abstract class TorrentAbstract extends BaseAttrObject {
$log['adjusted'] = ($log['Adjusted'] === '1');
$log['adjusted_checksum'] = ($log['AdjustedChecksum'] === '1');
$log['checksum'] = ($log['Checksum'] === '1');
$log['details'] = explode("\r\n", trim($log['Details'] ?? ''));
$log['details'] = trim($log['Details'] ?? '') ? explode("\r\n", trim($log['Details'])) : [];
if ($log['adjusted'] && $log['checksum'] !== $log['adjusted_checksum']) {
$log['details'][] = 'Bad/No Checksum(s)';
}

View File

@@ -53,7 +53,7 @@ class TorrentLog extends BaseObject {
AND LogID = ?
", $this->torrent->id(), $this->id
);
$info['detail_list'] = explode("\r\n", $info['Details'] ?? "\r\n");
$info['detail_list'] = trim($info['Details'] ?? '') ? explode("\r\n", $info['Details']) : [];
$info['adjustment_list'] = $info['AdjustmentDetails'] ? unserialize($info['AdjustmentDetails']) : [];
$this->info = $info;
return $this->info;

View File

@@ -367,6 +367,31 @@ class TorrentTest extends TestCase {
);
}
public function testLogfileList(): void {
$logfileSummary = new LogfileSummary([
'error' => [UPLOAD_ERR_OK],
'name' => ['valid_log_eac.log'],
'tmp_name' => [__DIR__ . '/../fixture/valid_log_eac.log'],
]);
$torrentLogManager = new Manager\TorrentLog();
$checkerVersion = Logchecker::getLogcheckerVersion();
foreach ($logfileSummary->all() as $logfile) {
$torrentLogManager->create($this->torrent, $logfile, $checkerVersion);
}
$expected = [
'has_riplog' => false,
'adjustment_details' => [],
'adjusted' => false,
'adjusted_checksum' => false,
'checksum' => true,
'details' => [],
];
$logfileList = $this->torrent->logfileList();
$this->assertCount(1, $logfileList);
$this->assertArrayIsEqualToArrayOnlyConsideringListOfKeys($expected, $logfileList[0], array_keys($expected));
$this->assertNotEmpty($logfileList[0]['html_log']);
}
public function testLogfileHashList(): void {
try {
$logfileSummary = new LogfileSummary([