Version Upload API: Handle \n for release notes #262

Merged
Dalai Felinto merged 2 commits from version-update-linebreak into main 2024-10-10 18:58:14 +02:00
Showing only changes of commit 399f412e54 - Show all commits

View File

@ -174,8 +174,8 @@ class ExtensionVersionSerializer(serializers.Serializer):
def validate_release_notes(self, value):
r"""Make sure \n and \r are valid after sanitation."""
if not value:
return value
if value is None:
return
dfelinto marked this conversation as resolved Outdated

why not a simple return?

why not a simple `return`?

To make sure if we get None we still return None, if we get "" we still return "".

I will change this so it test for None instead.

To make sure if we get None we still return None, if we get "" we still return "". I will change this so it test for None instead.
return value.replace('\\n', '\n').replace('\\r', '\r')