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

URL for current latest download #289

Merged

Conversation

HebaruSan
Copy link
Contributor

@HebaruSan HebaruSan commented Jun 24, 2020

Motivation

Currently SpaceDock supports these formats to download a mod:

  1. https://spacedock.info/mod/id/modname/download/version
  2. https://spacedock.info/mod/id/download/version

Both require you to know the version you want; it would be nice to generate a permalink that always returns the default version without having to know what it is.

Changes

Now a new URL format returns the default download for a given mod, based on format 1 above with the version omitted (these are not currently valid links and are provided just as examples):

The mod name can also be omitted:

If you name your mod download, it will be impossible to view the mod info page via the /mod/id/name route. But it will already be impossible to do all sorts of other things like update or edit, so too bad for you.

The Download button at the top of the mod info page and the Download buttons on the mod pack listing are updated to use the new URL format.

Fixes #251.

@DasSkelett
Copy link
Member

because Flask attempts to treat the second 'download' as a version name, which probably doesn't exist.

Should we also add frontend and/or backend checks to prevent anyone from creating a version named download? Would be surprising if anyone did that, but you never know...

@HebaruSan

This comment has been minimized.

@DasSkelett
Copy link
Member

This also seems to break mods with the name download, you can create them, but not update, edit or publish them, it always goes through the mods.download() route, and aborts with a 404 in the if not mod_version check.

@HebaruSan
Copy link
Contributor Author

Upon further investigation, SD's routes are already hopeless, even in prod. Never mind about //, there's no point in trying that...

Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, does work. I guess the chance that someone creates a mod or mod version named download is small enough that we don't have to care about it.

@HebaruSan HebaruSan merged commit 707f2fc into KSP-SpaceDock:alpha Jul 6, 2020
@HebaruSan HebaruSan deleted the feature/latest-download-links branch July 6, 2020 16:41
This was referenced Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants