Skip to content

Commit

Permalink
Fix Sentinel download via CDSE STAC catalogue reference
Browse files Browse the repository at this point in the history
  • Loading branch information
floeschau committed Aug 13, 2024
1 parent 7b5235c commit 87fc6d9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Stars.Data/Terradue.Stars.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
<!--<ItemGroup>
<ProjectReference Include="../../../terradue.opensearch.scihub/Terradue.OpenSearch.SciHub/Terradue.OpenSearch.SciHub.csproj" />
</ItemGroup>-->
<!-- <ItemGroup>
<ProjectReference Include="../../../../sugar/Terradue.OpenSearch.SciHub/Terradue.OpenSearch.SciHub/Terradue.OpenSearch.SciHub.csproj" />
</ItemGroup> -->
<!-- <ItemGroup>
<ProjectReference Include="../../../../sugar/Terradue.OpenSearch.Usgs/Terradue.OpenSearch.Usgs/Terradue.OpenSearch.Usgs.csproj" />
</ItemGroup> -->
<ProjectReference Include="../../../terradue.opensearch.usgs/Terradue.OpenSearch.Usgs/Terradue.OpenSearch.Usgs.csproj" />
</ItemGroup> -->
<ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="" />
<None Include="..\..\docs\logo\Stars_logo.png" Pack="true" PackagePath="" />
Expand Down
15 changes: 14 additions & 1 deletion src/Stars.Services/Resources/DefaultResourceServiceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,22 @@ public async Task<IStreamResource> CreateStreamResourceAsync(IResource resource,
try
{
// First try head request
using (var headResponse = await client.SendAsync(new HttpRequestMessage(HttpMethod.Head, resource.Uri), ct))
using (var hr = await client.SendAsync(new HttpRequestMessage(HttpMethod.Head, resource.Uri), ct))
{
HttpResponseMessage headResponse = hr;
contentHeaders = new HttpCachedHeaders(headResponse);
// Handle response error, but retry with a one-byte range in case of "Method not allowed" status code
/*if (headResponse.StatusCode == System.Net.HttpStatusCode.MethodNotAllowed)
{
//"Range: bytes=0-0
HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, resource.Uri);
message.Headers.Range = new System.Net.Http.Headers.RangeHeaderValue(0, 0);
using (var hr2 = await client.SendAsync(message, ct))
{
contentHeaders = new HttpCachedHeaders(headResponse);
headResponse = hr2;
}
}*/
headResponse.EnsureSuccessStatusCode();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Stars.Services/Supplier/Carrier/CarrierManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public async Task<IDeliveryQuotation> GetAssetsDeliveryQuotationsAsync(IAssetsCo
}
catch (Exception e)
{
logger.LogWarning("Cannot quote delivery for asset {0} with url {2} : {1}", asset.Key, e.Message, possibleAsset.Uri);
logger.LogWarning("Cannot quote delivery for asset {0} with url {1} : {2}", asset.Key, possibleAsset.Uri, e.Message);
logger.LogDebug(e.StackTrace);
assetsExceptions.Add(asset.Key, e);
}
Expand Down

0 comments on commit 87fc6d9

Please sign in to comment.