diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2a2c29a965..a121b1306b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -395,6 +395,7 @@ jobs: - name: Get Previous Release id: previous-release + continue-on-error: true uses: cardinalby/git-get-release-action@v1 env: GITHUB_TOKEN: ${{ github.token }} @@ -409,13 +410,17 @@ jobs: github-token: ${{ github.token }} result-encoding: string script: | - const { data } = await github.rest.repos.generateReleaseNotes({ + const previousTag = '${{ steps.previous-release.outputs.tag_name }}'; + const params = { owner: context.repo.owner, repo: context.repo.repo, tag_name: 'v${{ needs.build.outputs.version }}', target_commitish: '${{ github.sha }}', - previous_tag_name: '${{ steps.previous-release.outputs.tag_name }}', - }) + }; + if (previousTag) { + params.previous_tag_name = previousTag; + } + const { data } = await github.rest.repos.generateReleaseNotes(params); return data.body - name: Create Release diff --git a/src/NzbDrone.Host/Startup.cs b/src/NzbDrone.Host/Startup.cs index 573350c896b..e72628a6ec3 100644 --- a/src/NzbDrone.Host/Startup.cs +++ b/src/NzbDrone.Host/Startup.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Net; using DryIoc; using Microsoft.AspNetCore.Authorization; @@ -103,6 +104,8 @@ public void ConfigureServices(IServiceCollection services) { options.DefaultExpirationTimeSpan = TimeSpan.FromMinutes(cacheTtl); options.SizeLimit = cacheSize * 1024 * 1024; + options.AddPolicy("NewznabQuery", builder => + builder.With(context => !IsRssRequest(context.HttpContext.Request))); }); services @@ -293,9 +296,9 @@ public void Configure(IApplicationBuilder app, app.UseRouting(); app.UseCors(); - app.UseOutputCache(); app.UseAuthentication(); app.UseAuthorization(); + app.UseOutputCache(); app.UseResponseCompression(); app.Properties["host.AppName"] = BuildInfo.AppName; @@ -348,5 +351,25 @@ private void EnsureSingleInstance(bool isService, IStartupContext startupContext instancePolicy.PreventStartIfAlreadyRunning(); } } + + private static bool IsRssRequest(HttpRequest request) + { + var query = request.Query; + var requestType = query["t"].ToString(); + + if (requestType is not ("search" or "tvsearch" or "movie" or "music" or "book")) + { + return false; + } + + string[] searchParams = + { + "q", "imdbid", "tmdbid", "tvdbid", "rid", "tvmazeid", "traktid", "doubanid", + "season", "ep", "album", "artist", "label", "track", "year", "genre", + "author", "title", "publisher" + }; + + return searchParams.All(param => string.IsNullOrWhiteSpace(query[param].ToString())); + } } } diff --git a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs index c908c4adb1d..1875a122e5e 100644 --- a/src/Prowlarr.Api.V1/Indexers/NewznabController.cs +++ b/src/Prowlarr.Api.V1/Indexers/NewznabController.cs @@ -57,7 +57,7 @@ public NewznabController(IndexerFactory indexerFactory, [HttpGet("/api/v1/indexer/{id:int}/newznab")] [HttpGet("{id:int}/api")] - [OutputCache] + [OutputCache(PolicyName = "NewznabQuery")] public async Task GetNewznabResponse(int id, [FromQuery] NewznabRequest request) { var requestType = request.t;