mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-30 19:08:37 +00:00 
			
		
		
		
	Refactor packages (func name & UI) (#34773)
1. Use `OpenXxx` instead of `GetXxx` because the returned readers should be correctly closed, and clarify the behaviors of the functions: they increase the download counter 2. Use `packages-content` styles instead of `issue-content`
This commit is contained in:
		| @@ -59,7 +59,7 @@ func GetRepositoryFile(ctx *context.Context) { | ||||
| 		key += "|" + component + "|" + architecture | ||||
| 	} | ||||
|  | ||||
| 	s, u, pf, err := packages_service.GetFileStreamByPackageVersion( | ||||
| 	s, u, pf, err := packages_service.OpenFileForDownloadByPackageVersion( | ||||
| 		ctx, | ||||
| 		pv, | ||||
| 		&packages_service.PackageFileInfo{ | ||||
| @@ -106,7 +106,7 @@ func GetRepositoryFileByHash(ctx *context.Context) { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	s, u, pf, err := packages_service.GetPackageFileStream(ctx, pfs[0]) | ||||
| 	s, u, pf, err := packages_service.OpenFileForDownload(ctx, pfs[0]) | ||||
| 	if err != nil { | ||||
| 		if errors.Is(err, util.ErrNotExist) { | ||||
| 			apiError(ctx, http.StatusNotFound, err) | ||||
| @@ -210,7 +210,7 @@ func DownloadPackageFile(ctx *context.Context) { | ||||
| 	name := ctx.PathParam("name") | ||||
| 	version := ctx.PathParam("version") | ||||
|  | ||||
| 	s, u, pf, err := packages_service.GetFileStreamByPackageNameAndVersion( | ||||
| 	s, u, pf, err := packages_service.OpenFileForDownloadByPackageNameAndVersion( | ||||
| 		ctx, | ||||
| 		&packages_service.PackageInfo{ | ||||
| 			Owner:       ctx.Package.Owner, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user