Skip to content

Commit e2c3f4d

Browse files
daviddavisggainey
authored andcommitted
Don't leak overwrite kwarg into plugin validated_data
The overwrite field on NoArtifactContentSerializer was declared with default=True, which causes DRF to inject overwrite=True into validated_data even when the caller omits it. This broke plugins that splat **validated_data into a content model constructor (e.g. pulp_deb sync), producing: TypeError: Package() got unexpected keyword arguments: 'overwrite' Drop the field-level default and rely on the existing validated_data.pop('overwrite', True) in create() to preserve the 'absent => True' semantics. No behavior change for API callers. AI-Generated: github-copilot
1 parent d33e8a8 commit e2c3f4d

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Removed the `default=True` from the `overwrite` field on `NoArtifactContentSerializer` so it no
2+
longer leaks into `validated_data`. This fixes plugins that splat content serializer data
3+
(`**serializer.validated_data`).

pulpcore/app/serializers/content.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class NoArtifactContentSerializer(base.ModelSerializer):
3535
)
3636
overwrite = serializers.BooleanField(
3737
required=False,
38-
default=True,
3938
write_only=True,
4039
help_text=_(
4140
"When set to true, existing content in the repository with the same unique key "

0 commit comments

Comments
 (0)