briantist/galactory

500 error on collections/{namespace}/{collection} when a collection only contains pre-release versions

Closed this issue · 0 comments

We usually want to return the latest final version in the latest_verstion key returned by this API, so at the moment we filter out all non-final versions when we build the list, with the thought that eventually a final version will populate the field.

But in a collection where there are only pre-release versions, that field will never be populated. A different part of the code assumes it always will be populated, and crashes.

The question then is what should be in that key in that case.

I think that the logic should be that it contains the latest pre-release. If even a single final version exists, it will take precedence over any pre-release.

That seems to be supported by: