diff --git a/internal/report/report.go b/internal/report/report.go index 3c11a14..aee20ca 100644 --- a/internal/report/report.go +++ b/internal/report/report.go @@ -56,7 +56,11 @@ func Send(results []StepResult, issueURL, logPath string) error { now := time.Now().Format("2006-01-02 15:04") subject := fmt.Sprintf("xetup report %s", hostname) - body := buildHTML(results, hostname, now, issueURL) + + // Zip the log first (best-effort; nil attachment => plain email) so the + // body's footer can state accurately whether the log is actually attached. + attachName, attachData := zipLog(logPath, hostname) + body := buildHTML(results, hostname, now, issueURL, attachName) // Always save local copy so technician has a record even if SMTP fails _ = os.MkdirAll(filepath.Dir(localReportPath), 0755) @@ -64,9 +68,6 @@ func Send(results []StepResult, issueURL, logPath string) error { fmt.Fprintf(os.Stderr, "[WARN] Failed to save local report: %v\n", err) } - // Zip the log for attachment (best-effort; nil attachment => plain email) - attachName, attachData := zipLog(logPath, hostname) - // Retry SMTP up to 3 times with exponential backoff (1s, 5s, 15s) delays := []time.Duration{0, 1 * time.Second, 5 * time.Second} var lastErr error @@ -168,7 +169,7 @@ func writeBase64(w *bytes.Buffer, data []byte) { w.WriteString("\r\n") } -func buildHTML(results []StepResult, hostname, dateTime, issueURL string) string { +func buildHTML(results []StepResult, hostname, dateTime, issueURL, attachName string) string { var ok, errs, skipped int var rows strings.Builder @@ -235,14 +236,25 @@ func buildHTML(results []StepResult, hostname, dateTime, issueURL string) string %s
- Odeslano z xetup.exe — log v priloze (%s-Deploy.log.zip) i lokalne: C:\Windows\Setup\Scripts\Deploy.log + %s