forked from forgejo/forgejo
Add raw blob endpoint to get objects by SHA ID (#5334)
* Add raw blob endpoint This should make it possible to download raw blobs directly from /:repo/:username/raw/blob/:sha1 URLs. * fix: Make it work * As an SHA-ID is no path getRefNameFromPath can't be used to verify file specifying parameter * added relevant change in go-gitea/git #132 Signed-off-by: Berengar W. Lehr <Berengar.Lehr@kompetenztest.de> * Update Gopkg.lock Can't update all vendors due to errors Signed-off-by: Berengar W. Lehr <Berengar.Lehr@kompetenztest.de> * style: Add Gitea copyright header * feat: Added integration test for /repo/u/r/raw/blob * fix: correct year in copyright header
This commit is contained in:
parent
4651ba06c1
commit
e08c7e521b
6 changed files with 85 additions and 2 deletions
|
@ -693,6 +693,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|||
m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.SingleDownload)
|
||||
m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.SingleDownload)
|
||||
m.Get("/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.SingleDownload)
|
||||
m.Get("/blob/:sha", context.RepoRefByType(context.RepoRefBlob), repo.DownloadByID)
|
||||
// "/*" route is deprecated, and kept for backward compatibility
|
||||
m.Get("/*", context.RepoRefByType(context.RepoRefLegacy), repo.SingleDownload)
|
||||
}, repo.MustBeNotBare, context.CheckUnit(models.UnitTypeCode))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue