Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
453d3eb5
Commit
453d3eb5
authored
Jul 25, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
markdown: Fix when md file has front matter but empty body
parent
53b7b131
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
middleware/markdown/metadata.go
middleware/markdown/metadata.go
+6
-5
No files found.
middleware/markdown/metadata.go
View file @
453d3eb5
...
...
@@ -207,11 +207,7 @@ func extractMetadata(parser MetadataParser, b []byte) (metadata []byte, markdown
// Read remaining lines until closing identifier is found
for
{
line
,
err
:=
reader
.
ReadBytes
(
'\n'
)
if
err
!=
nil
{
if
err
==
io
.
EOF
{
// no closing metadata identifier found
return
nil
,
nil
,
fmt
.
Errorf
(
"metadata not closed ('%s' not found)"
,
parser
.
Closing
())
}
if
err
!=
nil
&&
err
!=
io
.
EOF
{
return
nil
,
nil
,
err
}
...
...
@@ -220,6 +216,11 @@ func extractMetadata(parser MetadataParser, b []byte) (metadata []byte, markdown
break
}
// if file ended, by this point no closing identifier was found
if
err
==
io
.
EOF
{
return
nil
,
nil
,
fmt
.
Errorf
(
"metadata not closed ('%s' not found)"
,
parser
.
Closing
())
}
metaBuf
.
Write
(
line
)
metaBuf
.
WriteString
(
"
\r\n
"
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment