Adding a git repository with a null/None description to a project returns a 500 error

If you add a respository without a description (i.e., a request to /api/repos/$name has a null description field), this results in an 500 internal server error response. I'm not sure yet about what is returned via the API (if one exists), so this is partly through the sr.ht UI.

Not sure if this belongs under hub.sr.ht at the moment. Project creation happens on sr.ht itself, so wasn't clear on that.

This can be reproduced with the following:

  1. Create a repository via the API without a description (just don't pass the field, it'll default to null instead of an empty string).[^1]

    When checking the repository via the API, its description should be null.

  2. Create a project (e.g., on https://sr.ht).

  3. Add the new repository to the project.

That should reproduce the error. I haven't dug around in the code or tried to run it myself yet, so unfortunately don't have much detail on this. Hopefully it's reproducible -- if not, I'll see if I can narrow it down further.

I also haven't tested to see if this applies to hg repositories.

Edit: Workaround for anyone encountering this, by the way, is to add a description to the repository (even if it's just an empty string).

[^1]: This also results in "None" showing in the UI when you edit the description, which might need to be a separate ticket if that's not intended.

Assigned to
3 years ago
3 years ago
No labels applied.