do not rely on "*" being present in configuration when picking file shard

This commit is contained in:
rootdarkarchon
2024-01-13 11:20:21 +01:00
parent c9030d933b
commit 810c6dbd45

View File

@@ -101,7 +101,8 @@ public class ServerFilesController : ControllerBase
} }
var shard = selectedShards var shard = selectedShards
.OrderBy(s => s.Continents.Contains("*", StringComparer.Ordinal) ? 0 : 1) .OrderBy(s => !s.Continents.Any() ? 0 : 1)
.ThenBy(s => s.Continents.Contains("*", StringComparer.Ordinal) ? 0 : 1)
.ThenBy(g => Guid.NewGuid()).FirstOrDefault(); .ThenBy(g => Guid.NewGuid()).FirstOrDefault();
baseUrl = shard?.CdnFullUrl ?? _configuration.GetValue<Uri>(nameof(StaticFilesServerConfiguration.CdnFullUrl)); baseUrl = shard?.CdnFullUrl ?? _configuration.GetValue<Uri>(nameof(StaticFilesServerConfiguration.CdnFullUrl));