Skip to content

Commit 9758023

Browse files
committed
apis/database: Fix ContentMetadata UnmarshalJSON
A string can be stored in json_metadata as well.
1 parent f4bba9c commit 9758023

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apis/database/data.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ func (content *Content) IsStory() bool {
9292

9393
type ContentMetadata struct {
9494
Flag bool
95+
Value string
9596
Users []string
9697
Tags []string
9798
Image []string
@@ -119,8 +120,11 @@ func (metadata *ContentMetadata) UnmarshalJSON(data []byte) error {
119120
}
120121

121122
if len(unquoted) == 0 {
122-
var value ContentMetadata
123-
metadata = &value
123+
return nil
124+
}
125+
126+
if unquoted[0] == '"' {
127+
metadata.Value = unquoted
124128
return nil
125129
}
126130

0 commit comments

Comments
 (0)