Only allow MusicBrainz tagged file on a pod (#2083)

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2607>
This commit is contained in:
Petitminion 2023-11-03 16:44:41 +01:00 committed by Marge
commit 2e3205a19d
3 changed files with 37 additions and 0 deletions

View file

@ -247,6 +247,15 @@ def process_upload(upload, update_denormalization=True):
return fail_import(
upload, "invalid_metadata", detail=detail, file_metadata=metadata_dump
)
if (
settings.ONLY_ALLOW_MUSICBRAINZ_TAGGED_FILES is True
and not serializer.validated_data.get("mbid")
):
return fail_import(
upload,
"Uploading files without a MusicBrainz ID is not permitted in this pod",
detail="You can tag you files with MusicBrainz Picard",
)
final_metadata = collections.ChainMap(
additional_data, serializer.validated_data, internal_config