Skip to content

Commit

Permalink
Added filename length restriction for debug mode (-srd flag)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Matveenko committed Dec 19, 2024
1 parent 358249b commit 6df1058
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,13 @@ func sanitizeFileName(fileName string) string {
}
func (w *StandardWriter) WriteStoreDebugData(host, templateID, eventType string, data string) {
if w.storeResponse {
if len(host) > 60 {
host = host[:57] + "..."
}
if len(templateID) > 100 {
templateID = templateID[:97] + "..."
}

filename := sanitizeFileName(fmt.Sprintf("%s_%s", host, templateID))
subFolder := filepath.Join(w.storeResponseDir, sanitizeFileName(eventType))
if !fileutil.FolderExists(subFolder) {
Expand All @@ -526,7 +533,6 @@ func (w *StandardWriter) WriteStoreDebugData(host, templateID, eventType string,
_, _ = f.WriteString(fmt.Sprintln(data))
f.Close()
}

}

// tryParseCause tries to parse the cause of given error
Expand Down

0 comments on commit 6df1058

Please sign in to comment.