fix(licenses): allow anonymous downloads when download_gating=none #437

Merged
jmiller merged 1 commits from dev into main 2026-06-02 20:26:51 +00:00
+10 -1
View File
@@ -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