diff --git a/services/context/repo.go b/services/context/repo.go index 9bb4240ec2..67e0c70811 100644 --- a/services/context/repo.go +++ b/services/context/repo.go @@ -447,7 +447,16 @@ func repoAssignmentLegacy(ctx *Context, data *repoAssignmentPrepareDataStruct) { // Check if a license key is provided in query params (for Joomla/WP clients). hasKey := ctx.FormString("dlid") != "" || ctx.FormString("key") != "" || ctx.FormString("download_key") != "" - if ctx.IsSigned || hasKey { + // Check if downloads are set to public (download_gating=none means no key needed). + downloadsPublic := false + if orgCfg != nil && (orgCfg.DownloadGating == "" || orgCfg.DownloadGating == "none") { + downloadsPublic = true + } + if repoCfg != nil && (repoCfg.DownloadGating == "" || repoCfg.DownloadGating == "none") { + downloadsPublic = true + } + + if ctx.IsSigned || hasKey || downloadsPublic { // Grant read-only access — downloads gated by CheckDownloadGating handler. ctx.Data["LicensingEnabled"] = licensingEnabled ctx.Data["HideReleaseDownloads"] = !hasKey && !ctx.IsSigned