-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown: 500 for YAML metadata #72
Comments
(Known issue - the line number in the panic message is +2 the actual, so line 64 is actual source of panic. Still not sure why the line number is off.) I thought I fixed this with commit 8ea98f8 - have you pulled the latest recently? ( |
Unfortunately, I get the described effect with the latest HEAD ... I added debug statements to the func (m *Metadata) load(parsedMap map[string]interface{}) {
fmt.Printf("-- %v\n", parsedMap)
if template, ok := parsedMap["title"]; ok {
m.Title, _ = template.(string)
}
if template, ok := parsedMap["template"]; ok {
m.Template, _ = template.(string)
}
if variables, ok := parsedMap["variables"]; ok {
fmt.Printf("-- %v\n", reflect.TypeOf(variables))
vars, ok := variables.(map[string]interface{})
m.Variables = vars
fmt.Printf("-- %v - %v\n", vars, ok)
}
} ... and get the following output: (YAML)
(TOML)
I might have some more time tomorrow for more debugging. |
Thanks for testing this out. I have seen the issue, the fix should be out soon. Firstly, the YAML syntax used for variables Should be
Secondly, the yaml package decodes nested maps into a Thanks. |
@mschoebel The fix has been merged. Let us know if it works now. Thanks. |
Works. 👍 YAML is weird. |
I played around with the markdown middleware:
Template (
default.html
):Caddyfile:
Test markdown file
test_yaml.md
:Result when accessing
http://localhost:8000/test_yaml.md
is500 Internal Server Error
. There is an entry inerror.log
saying:[PANIC /test_yaml.md] src/github.com/mholt/caddy/middleware/markdown/process.go:66 - assignment to entry in nil map
.The other formats (JSON, TOML) work as intended.
The text was updated successfully, but these errors were encountered: