From 3ebcc07fec2f124d5e41f9a3a273653908402eb0 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 16 Mar 2018 12:28:32 -0400 Subject: [PATCH] Fix bug in the markdown viewer Fixes https://jira.coreos.com/browse/QUAY-840 --- static/js/directives/ui/markdown/markdown-view.component.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/static/js/directives/ui/markdown/markdown-view.component.ts b/static/js/directives/ui/markdown/markdown-view.component.ts index d6045af03..3ba698942 100644 --- a/static/js/directives/ui/markdown/markdown-view.component.ts +++ b/static/js/directives/ui/markdown/markdown-view.component.ts @@ -30,7 +30,7 @@ export class MarkdownViewComponent implements OnChanges { if (changes['content']) { if (!changes['content'].currentValue && this.placeholderNeeded) { this.convertedHTML = this.$sce.trustAsHtml(this.placeholder); - } else if (this.firstLineOnly) { + } else if (this.firstLineOnly && changes['content'].currentValue) { const firstLine: string = changes['content'].currentValue.split('\n') // Skip code lines .filter(line => line.indexOf(' ') != 0) @@ -41,9 +41,8 @@ export class MarkdownViewComponent implements OnChanges { this.convertedHTML = this.$sanitize(this.markdownConverter.makeHtml(firstLine)); } else { - this.convertedHTML = this.$sanitize(this.markdownConverter.makeHtml(changes['content'].currentValue)); + this.convertedHTML = this.$sanitize(this.markdownConverter.makeHtml(changes['content'].currentValue || '')); } - } } }