mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-29 04:59:28 +02:00
feat: add architecture-specific removal support for arch package (#5351)
- [x] add architecture-specific removal support
- [x] Fix upload competition
- [x] Fix not checking input when downloading
docs: https://codeberg.org/forgejo/docs/pulls/874
### Release notes
- [ ] I do not want this change to show in the release notes.
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5351
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Exploding Dragon <explodingfkl@gmail.com>
Co-committed-by: Exploding Dragon <explodingfkl@gmail.com>
(cherry picked from commit 89742c4913
)
This commit is contained in:
parent
f0dab9cc05
commit
658ed564cb
7 changed files with 151 additions and 100 deletions
|
@ -175,18 +175,20 @@ func CommonRoutes() *web.Route {
|
|||
arch.PushPackage(ctx)
|
||||
return
|
||||
} else if isDelete {
|
||||
if groupLen < 2 {
|
||||
if groupLen < 3 {
|
||||
ctx.Status(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if groupLen == 2 {
|
||||
if groupLen == 3 {
|
||||
ctx.SetParams("group", "")
|
||||
ctx.SetParams("package", pathGroups[0])
|
||||
ctx.SetParams("version", pathGroups[1])
|
||||
ctx.SetParams("arch", pathGroups[2])
|
||||
} else {
|
||||
ctx.SetParams("group", strings.Join(pathGroups[:groupLen-2], "/"))
|
||||
ctx.SetParams("package", pathGroups[groupLen-2])
|
||||
ctx.SetParams("version", pathGroups[groupLen-1])
|
||||
ctx.SetParams("group", strings.Join(pathGroups[:groupLen-3], "/"))
|
||||
ctx.SetParams("package", pathGroups[groupLen-3])
|
||||
ctx.SetParams("version", pathGroups[groupLen-2])
|
||||
ctx.SetParams("arch", pathGroups[groupLen-1])
|
||||
}
|
||||
reqPackageAccess(perm.AccessModeWrite)(ctx)
|
||||
if ctx.Written() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue