Prevent out of bounds error on title with only whitespace
This commit is contained in:
parent
f933b36170
commit
d37ab544e8
2 changed files with 7 additions and 1 deletions
|
@ -182,7 +182,7 @@ func applyMarkdownSpecial(data []byte, skipNoFollow bool, baseURL string, cfg *c
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyBasicMarkdown(data []byte) string {
|
func applyBasicMarkdown(data []byte) string {
|
||||||
if len(data) == 0 {
|
if len(bytes.TrimSpace(data)) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,12 @@ func TestApplyBasicMarkdown(t *testing.T) {
|
||||||
result string
|
result string
|
||||||
}{
|
}{
|
||||||
{"empty", "", ""},
|
{"empty", "", ""},
|
||||||
|
{"empty spaces", " ", ""},
|
||||||
|
{"empty tabs", "\t", ""},
|
||||||
|
{"empty newline", "\n", ""},
|
||||||
|
{"nums", "123", "123"},
|
||||||
|
{"dot", ".", "."},
|
||||||
|
{"dash", "-", "-"},
|
||||||
{"plain", "Hello, World!", "Hello, World!"},
|
{"plain", "Hello, World!", "Hello, World!"},
|
||||||
{"multibyte", "こんにちは", `こんにちは`},
|
{"multibyte", "こんにちは", `こんにちは`},
|
||||||
{"bold", "**안녕하세요**", `<strong>안녕하세요</strong>`},
|
{"bold", "**안녕하세요**", `<strong>안녕하세요</strong>`},
|
||||||
|
|
Loading…
Add table
Reference in a new issue