1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Avoid 500 panic error when uploading invalid maven package file (#31014)

PackageDescriptor.Metadata might be nil (and maybe not only for maven).
This is only a quick fix.

The new `if` block is written intentionally to avoid unnecessary
indenting to the existing code.
This commit is contained in:
wxiaoguang
2024-05-20 14:44:16 +08:00
committed by GitHub
parent f48cc501c4
commit de9bcd1d23
4 changed files with 20 additions and 2 deletions

View File

@@ -1,4 +1,8 @@
{{if eq .PackageDescriptor.Package.Type "maven"}}
{{if and (eq .PackageDescriptor.Package.Type "maven") (not .PackageDescriptor.Metadata)}}
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4>
<div class="ui attached segment">{{ctx.Locale.Tr "packages.no_metadata"}}</div>
{{end}}
{{if and (eq .PackageDescriptor.Package.Type "maven") .PackageDescriptor.Metadata}}
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4>
<div class="ui attached segment">
<div class="ui form">