diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 335a8e462f68..b82591ca49b5 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3733,8 +3733,8 @@ def _serialize(self, id_encoder, serialization_options): # serialize Dataset objects only for jobs that can actually modify these models. assert serialization_options.serialize_dataset_objects - def to_int(n): - return int(n) if n is not None else 0 + def to_int(n) -> Optional[int]: + return int(n) if n is not None else None rval = dict_for( self, diff --git a/lib/galaxy/model/store/__init__.py b/lib/galaxy/model/store/__init__.py index 122af7529555..cee81a526cbb 100644 --- a/lib/galaxy/model/store/__init__.py +++ b/lib/galaxy/model/store/__init__.py @@ -650,6 +650,8 @@ def handle_dataset_object_edit(dataset_instance, dataset_attrs): file_name=source, create=True, ) + # Don't trust serialized file size + dataset_instance.dataset.file_size = None dataset_instance.dataset.set_total_size() # update the filesize record in the database if dataset_instance.deleted: