diff --git a/routers/web/repo/licenses.go b/routers/web/repo/licenses.go index f3b4c0f7f5..78106ce40b 100644 --- a/routers/web/repo/licenses.go +++ b/routers/web/repo/licenses.go @@ -258,7 +258,12 @@ func LicensesRegenerateMasterKey(ctx *context.Context) { // LicensesGenerateKey handles POST to generate a new key from a package. func LicensesGenerateKey(ctx *context.Context) { - packageID, _ := strconv.ParseInt(ctx.FormString("package_id"), 10, 64) + // Accept package_id from form body or query string (modal sets it via form action URL). + pkgIDStr := ctx.FormString("package_id") + if pkgIDStr == "" { + pkgIDStr = ctx.Req.URL.Query().Get("package_id") + } + packageID, _ := strconv.ParseInt(pkgIDStr, 10, 64) if packageID == 0 { ctx.Flash.Error("Invalid package") ctx.Redirect(ctx.Repo.RepoLink + "/licenses") diff --git a/templates/repo/licenses.tmpl b/templates/repo/licenses.tmpl index 217017853a..4744aa8d16 100644 --- a/templates/repo/licenses.tmpl +++ b/templates/repo/licenses.tmpl @@ -58,9 +58,7 @@