Пример #1
0
        /// <summary>
        /// Throw if index.json contains a different baseURI than the local settings.
        /// </summary>
        public static async Task EnsureBaseUriMatchesFeed(ISleetFileSystem fileSystem, ILogger log, CancellationToken token)
        {
            var expected = await GetBaseUriFromFeed(fileSystem, log, token);

            var actual = UriUtility.GetPathWithoutFile(fileSystem.Get("sleet.settings.json").EntityUri);

            // Feeds will typically be case sensitive, but this is only checking for obvious mismatches to notify the user of problems.
            if (!StringComparer.OrdinalIgnoreCase.Equals(actual.AbsoluteUri, expected.AbsoluteUri))
            {
                throw new InvalidDataException($"The path or baseURI set in sleet.json does not match the URIs found in index.json. To fix this update sleet.json with the correct settings, or recreate the feed to apply the new settings. Local settings: {actual.AbsoluteUri} Feed settings: {expected.AbsoluteUri}");
            }
        }