# HG changeset patch # User Mikael Berthe # Date 1521579556 -3600 # Node ID 71455784278b27d26af1669c5a6e3ccbce4b2a1b # Parent 1c058699177bd0ac370ce14bd48070d968bdf396 PlainPrinter: Fix attachment output diff -r 1c058699177b -r 71455784278b printer/plainprinter.go --- a/printer/plainprinter.go Tue Mar 20 21:53:57 2018 +0100 +++ b/printer/plainprinter.go Tue Mar 20 21:59:16 2018 +0100 @@ -190,10 +190,16 @@ indentedPrint(w, indent, true, false, "Attachment ID", "%d", a.ID) indentedPrint(w, indent, false, false, "Type", "%s", a.Type) indentedPrint(w, indent, false, false, "Local URL", "%s", a.URL) - indentedPrint(w, indent, false, true, "Remote URL", "%s", a.RemoteURL) + if a.RemoteURL != nil { + indentedPrint(w, indent, false, true, "Remote URL", "%s", *a.RemoteURL) + } indentedPrint(w, indent, false, true, "Preview URL", "%s", a.PreviewURL) - indentedPrint(w, indent, false, true, "Text URL", "%s", a.PreviewURL) - indentedPrint(w, indent, false, true, "Description", "%s", a.Description) + if a.TextURL != nil { + indentedPrint(w, indent, false, true, "Text URL", "%s", *a.TextURL) + } + if a.Description != nil { + indentedPrint(w, indent, false, true, "Description", "%s", *a.Description) + } return nil } @@ -348,7 +354,9 @@ } else if a.RemoteURL != nil { indentedPrint(w, indent+p.Indent, false, false, "Remote URL", "%s", *a.RemoteURL) } - indentedPrint(w, indent+p.Indent, false, true, "Description", "%s", a.Description) + if a.Description != nil && *a.Description != "" { + indentedPrint(w, indent+p.Indent, false, true, "Description", "%s", a.Description) + } } return nil }