fix(restore): properly decode notifications json data
Related to https://kolaente.dev/vikunja/api/issues/1199
This commit is contained in:
parent
ac92499b7d
commit
596d2bf676
1 changed files with 13 additions and 0 deletions
|
@ -136,6 +136,19 @@ func Restore(filename string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("could not read table %s: %w", table, err)
|
||||
}
|
||||
|
||||
// FIXME: There has to be a general way to do this but this works for now.
|
||||
if table == "notifications" {
|
||||
for i := range content {
|
||||
decoded, err := base64.StdEncoding.DecodeString(content[i]["notification"].(string))
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not decode notification %s: %w", content[i]["notification"], err)
|
||||
}
|
||||
|
||||
content[i]["notification"] = string(decoded)
|
||||
}
|
||||
}
|
||||
|
||||
if err := db.Restore(table, content); err != nil {
|
||||
return fmt.Errorf("could not restore table data for table %s: %w", table, err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue