Core: Add restricted_dumps helper (#5117)
* Add pickling helper that check unpicklability * Add test condition and generation error handling * Fix incorrect call and make imports consistent * Fix newline padding * Change PicklingError to directly caused by UnpicklingError Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com> * Revert to `pickle.dumps` for decompressed multidata * Fix import order * Restore pickle import in main * Re-add for multidata in Main * Remove multisave checks * Update MultiServer.py * Update customserver.py --------- Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com> Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
This commit is contained in:
@@ -129,7 +129,7 @@ class WebHostContext(Context):
|
||||
else:
|
||||
row = GameDataPackage.get(checksum=game_data["checksum"])
|
||||
if row: # None if rolled on >= 0.3.9 but uploaded to <= 0.3.8. multidata should be complete
|
||||
game_data_packages[game] = Utils.restricted_loads(row.data)
|
||||
game_data_packages[game] = restricted_loads(row.data)
|
||||
continue
|
||||
else:
|
||||
self.logger.warning(f"Did not find game_data_package for {game}: {game_data['checksum']}")
|
||||
@@ -159,6 +159,7 @@ class WebHostContext(Context):
|
||||
@db_session
|
||||
def _save(self, exit_save: bool = False) -> bool:
|
||||
room = Room.get(id=self.room_id)
|
||||
# Does not use Utils.restricted_dumps because we'd rather make a save than not make one
|
||||
room.multisave = pickle.dumps(self.get_save())
|
||||
# saving only occurs on activity, so we can "abuse" this information to mark this as last_activity
|
||||
if not exit_save: # we don't want to count a shutdown as activity, which would restart the server again
|
||||
|
||||
Reference in New Issue
Block a user