Fix for Issue 72: Markdown: 500 for YAML metadata

This commit is contained in:
Abiola Ibrahim
2015-05-13 00:44:35 +01:00
parent 018fd21741
commit 8394d72f48
2 changed files with 18 additions and 5 deletions

View File

@ -154,6 +154,19 @@ func (y *YAMLMetadataParser) Parse(b []byte) ([]byte, error) {
if err := yaml.Unmarshal(b, &m); err != nil {
return markdown, err
}
// convert variables (if present) to map[string]interface{}
// to match expected type
if vars, ok := m["variables"].(map[interface{}]interface{}); ok {
vars1 := make(map[string]interface{})
for k, v := range vars {
if key, ok := k.(string); ok {
vars1[key] = v
}
}
m["variables"] = vars1
}
y.metadata.load(m)
return markdown, nil
}