|
|
|
@ -128,7 +128,14 @@ func Jf2ToPost(jf2 microformats.Jf2) (Post, error) {
|
|
|
|
|
return post, err
|
|
|
|
|
}
|
|
|
|
|
normalized["kind"] = getPostKind(normalized)
|
|
|
|
|
if err = mapstructure.Decode(normalized, &post); err != nil {
|
|
|
|
|
decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
|
|
|
|
TagName: "json",
|
|
|
|
|
Result: &post,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return post, err
|
|
|
|
|
}
|
|
|
|
|
if err = decoder.Decode(normalized); err != nil {
|
|
|
|
|
return post, fmt.Errorf("%w: %s", ErrorInvalidPost, err.Error())
|
|
|
|
|
}
|
|
|
|
|
validate := validator.New()
|
|
|
|
|