Große Beiträge in Stabilitätsprotokollen brechen das Excel-CSV-Format

Mitarbeiter können Mitarbeiterprotokolle unter /admin/logs/staff_action_logs exportieren, um den vollständigen Verlauf einzusehen, da wir im Admin-Bereich nur eine Teilmenge der Protokolle anzeigen. Bestimmte Protokolle können Kommas in den Details enthalten, was das Format der CSV-Datei beeinträchtigt.

8 „Gefällt mir“

Can commas be escaped in this output @vinothkannans?

4 „Gefällt mir“

No, the commas are not breaking the CSV file. Maximum number of characters allowed in a single cell of MS Excel sheet is 32,767. If a column exceeded the characters limit then it’s breaking the CSV format. In our case details column having more characters in some post_edit staff actions. If I open the same CSV file in Google Sheets then it renders all the columns correctly.

If needed I’ll limit the maximum number of characters for details column to ~30,000 in the export unconditionally.

8 „Gefällt mir“

30k chars still seems like a lot. Do we need that many characters in a cell? If so, why?

It’s due to giant posts. For example, many of our internal runbooks tend to be quite long. Likely only the post_edit staff action as Vinoth noted would have this many characters.

Also we storing both old and new post raws for post_edit staff actions in discourse/app/services/staff_action_logger.rb at 4383afb769d97bc9724d5448c0583b14c39782d0 · discourse/discourse · GitHub.

We should aggressively truncate this, I don’t see the point of creating such bulk in the database over something so trivial.

5 „Gefällt mir“

Okay, I’ll try to improve this by storing only the edit differences in the raw text.

4 „Gefällt mir“

Ich möchte das hier abschließen. Machen wir es einfach: Begrenzen wir die Zellen auf 30k und schließen das dann ab. Die Delta-Sache ist eine sehr, sehr komplexe Änderung.

4 „Gefällt mir“

Wiedereröffnung. Wir brauchen eine Lösung, es ist fast unmöglich, exportierte Protokolle mit riesigen Beiträgen zu überprüfen, die die Formatierung zerstören.

1 „Gefällt mir“

Vielleicht ist die einfachste Lösung hier:\n\n\n\u003e '\"' + 'post \"body\" ' .gsub('\"', '\"\"') + '\"'\n=\u003e \"\\\"post \\\"\\\"body\\\"\\\" \\\"\"\n\n\nIch denke, das ist in CSV erlaubt und sollte funktionieren.