Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downloads: Handle duplicate version names #165

Open
wants to merge 2 commits into
base: stable
Choose a base branch
from

Conversation

Amphitryon0
Copy link

There are sometimes multiple versions with the same branch and name, such as 3.5-154 (00d303e) and 3.5-154 (2844708). The current behavior is to assume that never happens, so you get a 500 response if you look them up by name. This change defaults to the oldest version in that case and informs the visitor of the ambiguity.

This still needs to be tested; I don't know how to do so.

@OatmealDome
Copy link
Member

I've deployed your PR in our testing environment at dev.dolphin-emu.org. (The data there is based on the production database from around 7 months ago.)

It looks like an error is being thrown. Note that we're using an ancient version of Django at the moment.

If there is more than one version on a branch with a given shortrev,
get_object_or_404 would raise a MultipleObjectsReturned exception. It is
better just to pick one. Since these duplicate versions come from force
pushes, the oldest should be the original and thus the most useful one
to pick.
This information is included for hash-based lookups as well as
branch+shortrev-based since it's relevant in either case.
@Amphitryon0
Copy link
Author

The version is fine; I was just using it wrong. I've hopefully fixed that as well as an error when getting by name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants