@@ -29,6 +29,14 @@ def from_dict(cls, dt: dict) -> 'BackupMeta':
2929 version = dt .get ('_version' , 0 )
3030 if 'timestamp_ns' not in dt :
3131 dt ['timestamp_ns' ] = time .time_ns ()
32+
33+ # fix https://github.com/TISUnion/PrimeBackup/issues/87
34+ # where timestamp_ns was stored as float, and creator was stored as serialized Operator
35+ if isinstance (dt ['timestamp_ns' ], float ):
36+ dt ['timestamp_ns' ] = int (dt ['timestamp_ns' ])
37+ if isinstance (dt .get ('creator' , None ), dict ):
38+ dt ['creator' ] = str (Operator (type = dt ['creator' ]['type' ], name = dt ['creator' ]['name' ]))
39+
3240 return cls .deserialize (dt )
3341
3442 @classmethod
@@ -41,9 +49,9 @@ def get_default(cls: Type[Self]) -> Self:
4149 @classmethod
4250 def from_backup (cls , backup : BackupInfo ) -> 'BackupMeta' :
4351 return cls (
44- creator = backup .creator ,
52+ creator = str ( backup .creator ) ,
4553 comment = backup .comment ,
46- timestamp_ns = backup .timestamp_us * 1e3 ,
54+ timestamp_ns = backup .timestamp_us * 1000 ,
4755 targets = list (backup .targets ),
4856 tags = backup .tags .to_dict (),
4957 )
0 commit comments