diff options
| author | Agando <roduccomm@gmail.com> | 2026-10-18 17:19:14 +0200 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-10-18 17:19:14 +0200 |
| commit | 7e904aec06c09f7fdef0938155d2b9a19d36e314 (patch) | |
| tree | f859e146ad9e34c75d86ebcabefdb70a07ec4db9 /api/debug/report.php | |
| parent | 267b50588c736fdfec9a53488a2a39c608ebd7d4 (diff) | |
newOS4 v4.6.40: review fixes (bug diagnostics, trash tree, dir paste, stale capture, preview)
Diffstat (limited to 'api/debug/report.php')
| -rw-r--r-- | api/debug/report.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/api/debug/report.php b/api/debug/report.php index a4cf9f1..cefcae6 100644 --- a/api/debug/report.php +++ b/api/debug/report.php @@ -61,6 +61,13 @@ foreach (array_slice(array_reverse($existing), 0, 100) as $f) { $d = json_decode(@file_get_contents($f), true); if (!is_array($d)) continue; if (($d['fingerprint'] ?? '') === $fingerprint && strtotime($d['created_at'] ?? '') > $now - 86400) { + // Don't discard user content on a duplicate: keep it as an appended note. + $d['duplicate_count'] = (int)($d['duplicate_count'] ?? 0) + 1; + if ($body !== '' && ($d['body'] ?? '') !== $body) { + $d['body'] = trim((string)($d['body'] ?? '') . "\n---\n[duplicate " . gmdate('c') . "] " . $body); + $json = json_encode($d, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); + if ($json !== false) { @file_put_contents($f, $json); @chmod($f, 0664); } + } json_response([ 'success' => true, 'id' => $d['id'], @@ -91,6 +98,12 @@ if ($json === false || file_put_contents($file, $json) === false) { } @chmod($file, 0664); +// Regenerate the public page immediately so the URL we print is never stale. +$generator = realpath(__DIR__ . '/../../scripts/gen-bug-report.py'); +if ($generator) { + @exec('/usr/bin/python3 ' . escapeshellarg($generator) . ' 2>&1', $genOut, $genRc); +} + json_response([ 'success' => true, 'id' => $id, |