fix: Aufrufe der Oberfläche nicht als API-Anfragen zählen, Diagnose-Ordner zufällig und exklusiv anlegen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 09:33:01 +01:00
parent f80566290b
commit 317b9fd2cc
3 changed files with 27 additions and 3 deletions

View File

@ -55,8 +55,16 @@ fn run(args: &[String]) -> Result<String, String> {
!flags.has("ohne-engine-logs"),
);
let staging = std::env::temp_dir().join(format!("nexus-diag-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&staging);
// Zufälliger Name und exklusives Anlegen: Ein vorher angelegter Ordner oder
// Verweis eines anderen Benutzers in /tmp wird nicht benutzt.
let suffix = nexus_core::random_hex(8).map_err(|e| e.to_string())?;
let staging = std::env::temp_dir().join(format!("nexus-diag-{suffix}"));
std::fs::create_dir(&staging).map_err(|e| format!("{}: {e}", staging.display()))?;
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
let _ = std::fs::set_permissions(&staging, std::fs::Permissions::from_mode(0o700));
}
for (name, content) in &files {
let path = staging.join(name);
if let Some(parent) = path.parent() {