Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup and SDK update #117

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup dotnet 3.1 5.0 6.0
uses: actions/setup-dotnet@v1
- name: Setup dotnet SDKs
uses: actions/setup-dotnet@v1.9.0
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down Expand Up @@ -63,7 +62,7 @@ jobs:
- name: Prepare coverage reports
run: reportgenerator -reports:*/coverage/*/coverage.cobertura.xml -targetdir:./ -reporttypes:Cobertura
- name: Upload coverage report
uses: codecov/codecov-action@v1.0.13
uses: codecov/codecov-action@v4.3.0
with:
file: Cobertura.xml
fail_ci_if_error: false
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

A sitemap (sitemap.xml) querying and parsing library for .NET

![Build](https://img.shields.io/github/workflow/status/TurnerSoftware/sitemaptools/Build)
![Build](https://img.shields.io/github/actions/workflow/status/TurnerSoftware/sitemaptools/build.yml?branch=main)
[![Codecov](https://img.shields.io/codecov/c/github/turnersoftware/sitemaptools/master.svg)](https://codecov.io/gh/TurnerSoftware/SitemapTools)
[![NuGet](https://img.shields.io/nuget/v/TurnerSoftware.SitemapTools.svg)](https://www.nuget.org/packages/TurnerSoftware.SitemapTools)
</div>
Expand Down
9 changes: 6 additions & 3 deletions src/TurnerSoftware.SitemapTools/SitemapQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ public async Task<IEnumerable<Uri>> DiscoverSitemapsAsync(string domainName, Can

return result;
}


private static bool IsCompressedStream(string contentType) =>
contentType.Equals("application/x-gzip", StringComparison.InvariantCultureIgnoreCase) ||
contentType.Equals("application/octet-stream", StringComparison.InvariantCultureIgnoreCase);

/// <summary>
/// Retrieves a sitemap at the given URI, converting it to a <see cref="SitemapFile"/>.
/// </summary>
Expand All @@ -147,8 +151,7 @@ public async Task<IEnumerable<Uri>> DiscoverSitemapsAsync(string domainName, Can
var contentType = response.Content.Headers.ContentType.MediaType;
var requiresManualDecompression = false;

if (contentType.Equals("application/x-gzip", StringComparison.InvariantCultureIgnoreCase)||
contentType.Equals("application/octet-stream", StringComparison.InvariantCultureIgnoreCase))
if (IsCompressedStream(contentType))
{
requiresManualDecompression = true;
var baseFileName = Path.GetFileNameWithoutExtension(sitemapUrl.AbsolutePath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net461;net6.0;net8.0</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Loading