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

Offer a download link to specific release file #3712

Open
ahtcx opened this issue Mar 23, 2018 · 15 comments
Open

Offer a download link to specific release file #3712

ahtcx opened this issue Mar 23, 2018 · 15 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@ahtcx
Copy link

ahtcx commented Mar 23, 2018

How about one-upping GitHub and offering a direct download link to any file from any release. The best way I can think of would be with the following URL scheme, I don't they could interfere with any current ones.

URL Download
/{user}/{repo}/releases/download/latest/{name} name from latest stable release
/{user}/{repo}/releases/download/latest:stable/{name} name from latest stable release
/{user}/{repo}/releases/download/latest:prerelease/{name} name from latest prerelease
/{user}/{repo}/releases/download/tag:{tag}/{name} name from specific release tag

The URLs should 302 to the attachement URL, if no file or release exists it should 404. If you like the idea but have bigger priorities I could look into implementing it myself, though it will take some time since I've never contributed to a big project, nor used Go.

This is really useful to provide a static URL to the latest release similar to wordpress.org/latest.zip that can be used by scripts. Instead it would look more like /wordpress/wordpress/releases/download/latest/wordpress.zip.

@ahtcx
Copy link
Author

ahtcx commented Mar 23, 2018

I'm not sure how it could be handled when a release offers multiple files with the same name, but who does that anyway?

@lafriks
Copy link
Member

lafriks commented Mar 23, 2018

If semantic versioning of tags is taken into account I like the idea

@lafriks lafriks added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Mar 23, 2018
@ahtcx
Copy link
Author

ahtcx commented Mar 24, 2018

/{user}/{repo}/releases/download/version:{constraint}/{name} would be pretty cool! I'm currently setting up the dev environment and hopefully I can implement this!

@ahtcx
Copy link
Author

ahtcx commented Mar 25, 2018

I'm currently working on this and am unsure how to "cleanly" tackle the problem of multiple attachements with the same name, do you think it would make sense to ban attachements with the same file name? If not any ideas of how to make every single attachement accessible, including files with the same name?

@lafriks
Copy link
Member

lafriks commented Mar 25, 2018

I think that attachments with same name should not be allowed

@meoso
Copy link

meoso commented Apr 3, 2018

I request this or similar also please. i was using https://dl.gitea.io/gitea/master/gitea-master-linux-amd64 up until very recently, now it no longer exists, so my weekly update script no longer works.

@lafriks
Copy link
Member

lafriks commented Apr 3, 2018

@meoso it will be back soon again, we did move over infra to larger disk space, so not everything is back. As soon as our drone instance will be fully working again master downloads will be available again

@DjSni
Copy link

DjSni commented Aug 18, 2019

I think it should also be integrated into the API.
Is there any news ?

@l-2-j
Copy link

l-2-j commented May 4, 2022

Handling multiple attachments with the exact same filename sounds like the 300 Multiple Choices status header would work well. At least if there's no other reason to deny multiple attachments with the same filename?

If I understand the specification of said header correctly, it could just return a list of attachments in a similar vein as the API already does for retrieving the attachments (/repos/{owner}/{repo}/releases/{id}/assets)? Though of course filtered to only contain the attachments with the matching filename.

And that way it could later on be potentially extended to match with just partial filenames (*.exe?partialmatch=true -> foo-vX.Y.Z.exe & bar-vZ.Y.X.exe) type of a thing.

@Mai-Lapyst
Copy link
Contributor

Is anyone currently working on this? If not I would start working on this.

@nerdCopter

This comment was marked as off-topic.

@Mai-Lapyst
Copy link
Contributor

Mai-Lapyst commented May 29, 2022

i would love URL = https://dl.gitea.io/gitea/master/gitea-master-linux-amd64 or similar. it worked great when it worked.

  1. I think this is a bit off-topic from the original issue, but
  2. This still works; the only thing is that the master branch was renamed to main: https://dl.gitea.io/gitea/main/gitea-main-linux-amd64

@Garionion
Copy link
Contributor

Garionion commented May 31, 2022

I have had build a very simple api wrapper which (for now) does only a 307 (basically the same as 302) to the actual file.
gitea-attachements-proxy
there also exists a docker image
One can use the following patterns:

/:user/:repo/releases/download/latest/:name
/:user/:repo/releases/download/latest\\::channel/:name
/:user/:repo/releases/download/tag\\::tag/:name

eg: /garionion/fluffychat/releases/download/tag:v1.3.0/fluffychat-linux-x86.tar.zst

I wanted to do actual proxying and maybe caching but if gitea itself gets this feature i may abandon my "solution"

EDIT:
it uses GITEA_URL from env as upstream url

@Mai-Lapyst
Copy link
Contributor

I did some work today on this and i fugured out that gitea currently provides an api for at least tag-based access to attachments; eg: /:user/:repo/releases/download/:tag/:fileName.

This now poses the problem that the new API cannot be implemented directly since it would require to remove the already existing API and thus making this feature a breaking change.

So the question is: do we want to switch to the new API / URL scheme or do we want an alternative route for this?

@dboreham
Copy link

Is anyone working on this? It looks pretty straightforward to implement. Add another route like this one : https://github.com/go-gitea/gitea/blob/main/routers/web/web.go#L961 to signify "latest" (we can't just specify a vTag of "latest" because that might be a valid tag) and extend the code here to pick the latest release: https://github.com/go-gitea/gitea/blob/main/routers/web/repo/repo.go#L359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

9 participants