1
0
Fork 0
forked from forgejo/forgejo

Fix handling of Debian files with trailing slash (#26087) (#26098)

Backport #26087 by @KN4CK3R

Fixes #26022

- Fix handling of files with trailing slash
- Fix handling of duplicate package file errors
- Added test for both

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit a424f6d4f8)
This commit is contained in:
Giteabot 2023-07-24 10:56:13 -04:00 committed by Earl Warren
parent 1cd4d4b00e
commit 4be3270e87
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 67 additions and 47 deletions

View file

@ -195,7 +195,7 @@ func UploadPackageFile(ctx *context.Context) {
)
if err != nil {
switch err {
case packages_model.ErrDuplicatePackageVersion:
case packages_model.ErrDuplicatePackageVersion, packages_model.ErrDuplicatePackageFile:
apiError(ctx, http.StatusBadRequest, err)
case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize:
apiError(ctx, http.StatusForbidden, err)